2
<div id = "result">Roll No 103 Pass</div>
和出放得值應爲:卷103個通
我用這個代碼:
$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;
}
}
,但它只是返回黑屏