I need to get value from
<div id = "result">Roll No 103 Pass</div>
and out put should be : Roll No 103 Pass
I used this code :
$markup = file_get_contents('www.results.com');
$doc = new DomDocument();
@$file = $doc->loadHTML($markup);
$spans = $doc->getElementsByTagName('div');
foreach($spans AS $span)
{
$class = $span -> getElementsById('id');
if($class=="result") {
echo $span -> nodeValue;
}
}
but it just return blank screen
1 Answer