Parsing PHP简单HTML DOM解析器-错误
我有以下代码:Parsing PHP简单HTML DOM解析器-错误,parsing,dom,Parsing,Dom,我有以下代码: <?php header('Content-type: text/plain; charset=utf-8'); include('simple_html_dom.php'); $html = file_get_html('http://test.com/'); $class = $html->find("thisisatest", 0)->innertext; echo $class; ?> 错误页: <br /> <b>N
<?php
header('Content-type: text/plain; charset=utf-8');
include('simple_html_dom.php');
$html = file_get_html('http://test.com/');
$class = $html->find("thisisatest", 0)->innertext;
echo $class;
?>
错误页:
<br />
<b>Notice</b>: Trying to get property of non-object in <b>C:\xamp\htdocs\test\test.php</b> on line <b>6</b><br />
为什么有时候一切正常,有时候我会出错 打印html以查看您得到的内容可能很有用。无法重定向url。使用curl可能有助于获得更一致的结果并进行错误检查