喜 使用与simplehtmldom脚本代码(http://simplehtmldom.sourceforge.net/manual.htm): 我得到了一些错误吧:使用简单的HTML DOM
未能打开流: HTTP请求 失败!
我认为应该在这个脚本中使用curl而不是file_get_contents。 任何人都有一个想法如何inser卷曲在这个剧本?
喜 使用与simplehtmldom脚本代码(http://simplehtmldom.sourceforge.net/manual.htm): 我得到了一些错误吧:使用简单的HTML DOM
未能打开流: HTTP请求 失败!
我认为应该在这个脚本中使用curl而不是file_get_contents。 任何人都有一个想法如何inser卷曲在这个剧本?
function get_data($url)
{
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
$url = 'http://simplehtmldom.sourceforge.net/manual.htm';
echo $data = get_data($url);
我做这在我的CentOS
yum install php-mbstring
yum install php-xml
yum install php-xmlrpc
每一件事情之后曾与simple_html_dom类
目前已经实现卷曲而不是file_get_contents
found here一个simple_html_dom
版本。
我在使用这个版本改变file_get_html
功能 - >负载调用是这样的:
$dom->load(getWithCurl($args[0]));
与getWithCurl
功能从get remote HTML with cURL and PHP拍摄。
它工作正常。
我们需要更多的信息。你有你的实际文件吗?有超过1个简单的HTML DOM脚本。 – Jem 2011-06-04 21:17:00
警告:file_get_contents(http://example.com/new/id_123.html)无法打开流:HTTP请求失败!在/var/www/vhosts/domain/httpdocs/simple_html_dom.php在线40 其中第40行是$ dom-> load(call_user_func_array('file_get_contents',$ args),true); – goni 2011-06-04 21:48:44
你可以从http://webarto.com/82/php-simple-html-dom-curl – 2011-07-13 12:50:45