Fatal error: Call to a member function find() on boolean in /m/viooz.ac.php on line 12
以上是在我们的页面上显示的错误,当我们尝试和刮下请求的站点的a元素查看下面的代码。
$page = (isset($_GET['p'])&&$_GET['p']!=0) ? (int) $_GET['p'] : '';
$html = file_get_html('http://viooz.ac/movies/page/1/');
foreach($html->find('a') as $element) {
print '
';
echo $url = ''.$element->href;
$html2 = file_get_html($url);
print '
';
$link = $html2->find('.cont_display a',0);
print $link = $link->href;
}
现在我知道肯定有在网站上标签,我们正在寻找它让怎么过不管我怎么改变返回的错误..
线75 simple_html_dom.php只是说:下列。
function file_get_html($url, $use_include_path = false, $context=null, $offset = -1, $maxLen=-1, $lowercase = true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
{
// We DO force the tags to be terminated.
$dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $stripRN, $defaultBRText, $defaultSpanText);
// For sourceforge users: uncomment the next line and comment the retreive_url_contents line 2 lines down if it is not already done.
$contents = file_get_contents($url, $use_include_path, $context, $offset);
// Paperg - use our own mechanism for getting the contents as we want to control the timeout.
//$contents = retrieve_url_contents($url);
if (empty($contents) || strlen($contents) > MAX_FILE_SIZE)
{
return false;
}
// The second parameter can force the selectors to all be lowercase.
$dom->load($contents, $lowercase, $stripRN);
return $dom;
}
WARNING: Don't view the content destination unless you have an ad-block you will get loads of popups.
编辑:即使在更改URL后返回相同的问题
Fatal error: Call to a member function find() on boolean in /m/viooz.ac.php on line 18
我觉得虽然我已经想通一些东西,加载页面时,它会创建一个随机的div其触发弹出窗口,除非你删除该div或触发它的其他元素不会出现..这可能是什么原因导致我们的问题?
+1
但是... http://viooz.ac/movies/page/1确实给了404.它确实没有找到。所以你的错误是预期的。有什么问题? –
+0
@jszobody即使我更正了URL http://viooz.ac/movies/page/1/,我可以确认它确实存在,但在查找“a”元素时此错误仍然保持不变。 –
+0
您试图访问的页面正在抛出404 - 服务器找不到页面。即使它在浏览时显示页面,它也会发送404错误而不是200 OK消息。 –