我正试图从网站上抓取特定数据,但无法取得任何进展..我找到了解析html dom的解决方案..它适用于其他网站,但不适用于我想要的刮。显示此错误
警告: 的file_get_contents(http://www.example.com/): 无法打开流:HTTP请求失败! HTTP / 1.0 404没有这样的文件 在第641行的路径文件夹/ simple_html_dom.php中
AdvancedHtmlDom Object([xpath] => [root] => [doc] => AdvancedHtmlDom 对象 RECURSION [dom] => [node] => [is_text] => )
我想使用simple_html_dom不使用Curl来抓取这些数据。如果有人知道如何解决这个问题。
的index.php
<?php
require('simple_html_dom.php');
// Create DOM from URL or file
$html = file_get_html('http://www.example.com/');
print_r($html);
?>
第641行的代码
function str_get_html($html)
{
return new AdvancedHtmlDom($html);
}
function file_get_html($url)
{
return str_get_html(file_get_contents($url));
}