" ":
<?php
$b = new GetUserInfo();
echo $b->getinfo("http://www.worldoftanks.ru/community/accounts/named/$name/");
class GetUserInfo {
public function getinfo($link){
$tagName = 'td';
$attrName = 'class';
$attrValue = 'value';
$dom = new DOMDocument;
$dom->preserveWhiteSpace = false;
@$dom->loadHTMLFile($link);
$html = $this->getTags($dom, $tagName, $attrName, $attrValue );
$string.=$html[$i]."<br>";
}
return $string;
}
private function getTags( $dom, $tagName, $attrName, $attrValue ){
$html = "";
$domxpath = new DOMXPath($dom);
$filtered = $domxpath->query("//$tagName" . '[@' . $attrName . "='$attrValue']");
$i = 0;
while( $myItem = $filtered->item($i++) ){
$html[$i]=$myItem->nodeValue;
}
return $html ;
}
}
?>
, , images.
... =(
7 , 13 , 19 (5.01.2012 - 14:34) inpost ():
. $html , , .
print_r .
print_r .
20 , 4 , 28 (6.01.2012 - 10:39) raydon ():
... , :
:
:
?
$string.="<img src=http://mysite/image/_".$html[$i]."_.jpg /><br>";
:
http://mysite/image/__.jpg
:
http://mysite/image/_ Type 59 _.jpg
?
1 , 4 , 35 (6.01.2012 - 11:43) inpost ():
$i ? , ?
print_r, $i .
, , , .
print_r, $i .
, , , .
16 , 39 (6.01.2012 - 12:00) raydon ():
:
... .. .
:
"image", =(
$string.="<img src=http://mysite/image/".$html[$i];
... .. .
:
print_r ("<img src=http://mysite/image/$html[1].jpg /><br>");
"image", =(
3 , 35 (6.01.2012 - 12:04) inpost ():
print_r ("<img src=http://mysite/image/$html[1].jpg /><br>");
? ? print_r , . , , $i.
12 , 8 (6.01.2012 - 12:16) raydon ():
$html ... , , .
, .
. ( ) , , =(
, .
. ( ) , , =(
5 , 46 , 5 (6.01.2012 - 18:02) inpost ():
(!) foreach, .
, .
!
, .
!
1 , 5 , 41 (6.01.2012 - 19:07) raydon ():
<?php
$b = new GetUserInfo();
echo $b->getinfo("http://www.worldoftanks.ru/community/accounts/named/$name/");
class GetUserInfo {
public function getinfo($link){
$tagName = 'td';
$attrName = 'class';
$attrValue = 'value';
$dom = new DOMDocument;
$dom->preserveWhiteSpace = false;
@$dom->loadHTMLFile($link);
$html = $this->getTags($dom, $tagName, $attrName, $attrValue );
$string.=$html[$i]."<br>";
}
return $string;
}
private function getTags( $dom, $tagName, $attrName, $attrValue ){
$html = "";
$domxpath = new DOMXPath($dom);
$filtered = $domxpath->query("//$tagName" . '[@' . $attrName . "='$attrValue']");
$i = 0;
while( $myItem = $filtered->item($i++) ){
$html[$i]=$myItem->nodeValue;
}
foreach ($html as &$value) {
$value = "<img src=http://mysite/image/_.$value._.jpg />" ;
}
unset($value)
return $html ;
}
}
?>
"http://mysite/image/_", , , :
<img src="http://mysite/image/_." type 59 ._.jpg>
? ?
50 (6.01.2012 - 19:57) inpost ():
. .
, . , , . - echo,print.
$value ,
, , , ͨ return $html print_r($html); , .
, . , , . - echo,print.
$value ,
foreach($html as $k=>$v)
$html[$k] = '<img src=http://mysite/image/_.'.$value..'_.jpg />';
, , , ͨ return $html print_r($html); , .
9 , 39 , 6 (7.01.2012 - 05:37) raydon ():
:
:
, - =(
? .. "-54" , -. . ?
foreach($html as $k=>$v)
$html[$k] = "<img src=http://mysite/image/_".$v."_.jpg />";
print_r($html);
:
<b> :</b><br>
</body>
</html>
Array
(
[1] => <img src=http://mysite/image/_
Type 59
_.jpg />
[2] => <img src=http://mysite/image/_
-54
_.jpg />
, - =(
? .. "-54" , -. . ?
6 , 51 , 22 (7.01.2012 - 12:28) inpost ():
$v . !
$array = array("\n","\r"," ");
$temp = str_replace($array,'',$v);
$html[$k] = '<img src="http:///manul.su/!test/image/_'.$temp.'_.jpg" />';
19 , 33 , 58 (8.01.2012 - 08:02) raydon ():
, ?
=(
foreach($html as $k=>$v)
$array = array("\n","\r"," ");
$temp = str_replace($array,'',$v);
$html[$k] = "<img src=http:/mysite/image/_".$temp."_.jpg />";
=(
3 , 46 (8.01.2012 - 08:06) raydon ():
=) =)
=)
!!!
foreach($html as $k=>$v)
{
$array = array("\n","\r"," ");
$temp = str_replace($array,'',$v);
$html[$k] = "<img src=http://mysite/image/_".$temp."_.jpg />";
}
=)
!!!
57 , 12 (8.01.2012 - 09:03) raydon ():
=( prtint_r =(
=(
=(
1 , 32 , 29 (8.01.2012 - 10:35) nugle ():
, var_dump($html);
2 , 40 , 34 (8.01.2012 - 13:16) inpost ():
? , . , , http://mysite <- ?
, . , !
, . , !
25 , 44 (8.01.2012 - 13:42) raydon ():
:
:
... , =(
... print_r return =(
<?php
$b = new GetUserInfo();
echo $b->getinfo("http://www.worldoftanks.ru/community/accounts/named/$name/");
class GetUserInfo {
public function getinfo($link){
$tagName = 'td';
$attrName = 'class';
$attrValue = 'value';
$dom = new DOMDocument;
$dom->preserveWhiteSpace = false;
@$dom->loadHTMLFile($link);
$html = $this->getTags($dom, $tagName, $attrName, $attrValue );
for($i=0; $i<count($html); $i++){
$string.=$html[$i];
}
return $string;
}
private function getTags($dom, $tagName, $attrName, $attrValue ){
$html = "";
$domxpath = new DOMXPath($dom);
$filtered = $domxpath->query("//$tagName" . '[@' . $attrName . "='$attrValue']");
$i = 0;
while( $myItem = $filtered->item($i++) ){
$html[$i]=$myItem->nodeValue;
}
foreach($html as $k=>$v){
$array = array("\n","\r"," ");
$temp = str_replace($array,'',$v);
$html[$k] = "<img src=http://mysite/image/".$temp.".jpg /><br>";
}
print_r ($html);
}
}
?>
:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<title> </title>
</head>
<body>
<a href="http://mysite"> </a>
<h1>Nik: MyNik</h1><br>
<b> :</b><br>
array(66) {
[1]=>
string(54) "<img src=http://mysite/image/Type59.jpg /><br>"
[2]=>
string(53) "<img src=http://mysite/image/Т-54.jpg /><br>"
[3]=>
string(54) "<img src=http://mysite/image/ИС-3.jpg /><br>"
[4]=>
string(63) "<img src=http://mysite/image/Объект212.jpg /><br>"
[5]=>
string(54) "<img src=http://mysite/image/ИС-4.jpg /><br>"
[6]=>
string(53) "<img src=http://mysite/image/Т-44.jpg /><br>"
[7]=>
string(55) "<img src=http://mysite/image/СУ-14.jpg /><br>"
[8]=>
string(54) "<img src=http://mysite/image/КВ-3.jpg /><br>"
[9]=>
string(52) "<img src=http://mysite/image/ИС.jpg /><br>"
[10]=>
string(56) "<img src=http://mysite/image/Т-34-85.jpg /><br>"
[11]=>
string(54) "<img src=http://mysite/image/СУ-8.jpg /><br>"
[12]=>
string(52) "<img src=http://mysite/image/КВ.jpg /><br>"
[13]=>
string(51) "<img src=http://mysite/image/T32.jpg /><br>"
[14]=>
string(51) "<img src=http://mysite/image/T29.jpg /><br>"
[15]=>
string(53) "<img src=http://mysite/image/Т-43.jpg /><br>"
[16]=>
string(51) "<img src=http://mysite/image/M41.jpg /><br>"
[17]=>
string(54) "<img src=http://mysite/image/СУ-5.jpg /><br>"
[18]=>
string(63) "<img src=http://mysite/image/Объект261.jpg /><br>"
[19]=>
string(59) "<img src=http://mysite/image/M26Pershing.jpg /><br>"
[20]=>
string(52) "<img src=http://mysite/image/T-34.jpg /><br>"
[21]=>
string(50) "<img src=http://mysite/image/M6.jpg /><br>"
[22]=>
string(51) "<img src=http://mysite/image/M12.jpg /><br>"
[23]=>
string(55) "<img src=http://mysite/image/T1heavy.jpg /><br>"
[24]=>
string(56) "<img src=http://mysite/image/M7Priest.jpg /><br>"
[25]=>
string(53) "<img src=http://mysite/image/Т-50.jpg /><br>"
[26]=>
string(55) "<img src=http://mysite/image/AMX1375.jpg /><br>"
[27]=>
string(61) "<img src=http://mysite/image/M4A3E8Sherman.jpg /><br>"
[28]=>
string(53) "<img src=http://mysite/image/Т-28.jpg /><br>"
[29]=>
string(56) "<img src=http://mysite/image/КВ-1С.jpg /><br>"
[30]=>
string(56) "<img src=http://mysite/image/СУ-100.jpg /><br>"
[31]=>
string(53) "<img src=http://mysite/image/С-51.jpg /><br>"
[32]=>
string(59) "<img src=http://mysite/image/T2LightTank.jpg /><br>"
[33]=>
string(55) "<img src=http://mysite/image/СУ-85.jpg /><br>"
[34]=>
string(55) "<img src=http://mysite/image/Т-50-2.jpg /><br>"
[35]=>
string(55) "<img src=http://mysite/image/СУ-26.jpg /><br>"
[36]=>
string(53) "<img src=http://mysite/image/А-20.jpg /><br>"
[37]=>
string(53) "<img src=http://mysite/image/M3Lee.jpg /><br>"
[38]=>
string(54) "<img src=http://mysite/image/МС-1.jpg /><br>"
[39]=>
string(55) "<img src=http://mysite/image/СУ-18.jpg /><br>"
[40]=>
string(51) "<img src=http://mysite/image/T20.jpg /><br>"
[41]=>
string(53) "<img src=http://mysite/image/Т-46.jpg /><br>"
[42]=>
string(57) "<img src=http://mysite/image/СУ-85Б.jpg /><br>"
[43]=>
string(61) "<img src=http://mysite/image/VK1602Leopard.jpg /><br>"
[44]=>
string(50) "<img src=http://mysite/image/M7.jpg /><br>"
[45]=>
string(54) "<img src=http://mysite/image/ИС-7.jpg /><br>"
[46]=>
string(60) "<img src=http://mysite/image/M2MediumTank.jpg /><br>"
[47]=>
string(56) "<img src=http://mysite/image/M3Stuart.jpg /><br>"
[48]=>
string(54) "<img src=http://mysite/image/БТ-2.jpg /><br>"
[49]=>
string(53) "<img src=http://mysite/image/Т-26.jpg /><br>"
[50]=>
string(54) "<img src=http://mysite/image/БТ-7.jpg /><br>"
[51]=>
string(56) "<img src=http://mysite/image/M5Stuart.jpg /><br>"
[52]=>
string(51) "<img src=http://mysite/image/M37.jpg /><br>"
[53]=>
string(55) "<img src=http://mysite/image/СУ-76.jpg /><br>"
[54]=>
string(50) "<img src=http://mysite/image/B1.jpg /><br>"
[55]=>
string(56) "<img src=http://mysite/image/M3Stuart.jpg /><br>"
[56]=>
string(54) "<img src=http://mysite/image/AMX12t.jpg /><br>"
[57]=>
string(54) "<img src=http://mysite/image/АТ-1.jpg /><br>"
[58]=>
string(61) "<img src=http://mysite/image/MkVIITetrarch.jpg /><br>"
[59]=>
string(50) "<img src=http://mysite/image/D2.jpg /><br>"
[60]=>
string(54) "<img src=http://mysite/image/BDRG1B.jpg /><br>"
[61]=>
string(50) "<img src=http://mysite/image/D1.jpg /><br>"
[62]=>
string(51) "<img src=http://mysite/image/T57.jpg /><br>"
[63]=>
string(60) "<img src=http://mysite/image/T2MediumTank.jpg /><br>"
[64]=>
string(53) "<img src=http://mysite/image/AMX38.jpg /><br>"
[65]=>
string(53) "<img src=http://mysite/image/AMX40.jpg /><br>"
[66]=>
string(61) "<img src=http://mysite/image/Leichttraktor.jpg /><br>"
}
</body>
</html>
... , =(
... print_r return =(
2 , 22 , 48 (8.01.2012 - 16:04) nugle ():
?
foreach($html as $key=>$val)
echo $val;
12 , 2 (8.01.2012 - 16:16) raydon ():
, ?
16 , 58 (8.01.2012 - 16:33) nugle ():
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
49 , 50 (8.01.2012 - 17:23) raydon ():
!
, ! !!!
, ! !!!