使用简单的html dom [英] Using simple html dom
问题描述
hi
使用这个代码和simplehtmldom脚本(http://simplehtmldom.sourceforge.net/manual.htm):
我遇到了一些错误:
hi Using this code with simplehtmldom script (http://simplehtmldom.sourceforge.net/manual.htm): I got some error with it:
无法开启串流:HTTP要求
失败!
failed to open stream: HTTP request failed!
认为应该在此脚本中使用curl而不是file_get_contents。
任何人都有想法如何在此脚本中插入curl?
I think should be use curl instead of file_get_contents in this script. Anyone have an idea how to inser curl in this script?
推荐答案
已经实现cURL的simple_html_dom 版本 file_get_contents
There is a simple_html_dom
version that already implement cURL instead file_get_contents
found here.
我使用此版本更改 file_get_html
函数在其 - >加载调用,如下所示:
I use this version changing file_get_html
function in its ->load call like this:
$dom->load(getWithCurl($args[0]));
与 getWithCurl
函数取自使用cURL和PHP获取远程HTML 。
它工作正常。
这篇关于使用简单的html dom的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!