【发布时间】:2012-01-13 16:00:02
【问题描述】:
我正要尝试使用简单的 HTML DOM 框架进行抓取:http://simplehtmldom.sourceforge.net/,但出于安全原因,file_get_contents 在服务器配置中被禁用。
我现在需要找到一个使用 Curl 的类似框架 - 有人知道吗?
尝试运行斜线点示例时收到的错误消息是:
Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /var/www/vhosts/domain.com/httpdocs/crawlfeed/simple_html_dom.php on line 70
【问题讨论】:
-
你不能只是 cURL 文件然后将文本字符串加载到 SimpleHTMLDOM 中吗?
-
您不必将 file_get_contents 与 simplehtml 一起使用。您可以使用 curl 自己获取 html 并将结果直接提供给 simplehtml。
-
您也可以单独执行 curl 请求,然后传入字符串。
$dom = str_get_html(curl($url)->returntransfer(1)->exec());
标签: php web-scraping