Created
May 30, 2011 08:39
-
-
Save ilyabrin/998614 to your computer and use it in GitHub Desktop.
PHP parser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
for ($i=1; $i <= 17441; $i++) { | |
$html = file_get_contents('http://www.vsmolenske.ru/firma.php?id='.$i); | |
echo $html; | |
break; | |
$Matched = array(); | |
/** создаем новый dom-объект **/ | |
$dom = new domDocument; | |
/** загружаем html в объект **/ | |
$dom->loadHTML($html); | |
$dom->preserveWhiteSpace = false; | |
/** элемент по тэгу **/ | |
$div_elements = $dom->getElementsByTagName('div'); | |
for($i=0;$i<$div_elements->length;$i++) { | |
/** получаем все вложенные элементы div **/ | |
/** $div_content = $div->item(0)->getElementsByTagName('tr'); **/ | |
if($div_elements->item($i)->attributes->getNamedItem('class')->nodeValue == 'fll inf_firm') { | |
$Matched[]=$div_elements->item($i); | |
} | |
} | |
return $Matched; | |
} | |
echo $Matched; | |
/* for end */ | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment