dimanche 21 octobre 2018

Parsing html, grabbing nodeValue problem with DOMdocument

Trying to parse html page, but having some trouble at grabbing nodeValue's of dt and dd tags.

$outlineUrl = "http://www.sumitomo-rd-mansion.jp/kansai/higashi_umeda/detail.cgi";
foreach ($outlineUrl as $results) {
       $html = file_get_contents($results);
       $DOMParser = new \DOMDocument();
       $DOMParser->loadHTML($html)           

   foreach ($DOMParser->getElementsByTagName('dl') as $tr) {
             $property = trim($tr->getElementsByTagName('dt')[0]->nodeValue);
             $value = trim($tr->getElementsByTagName('dd')[0]->nodeValue);
   }

with this I can't grab the dl's and dt's nodeValue. Is my foreach loops wrong or something? Thanks for helping me out!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire