小编Cha*_*hra的帖子

警告:file_get_contents:无法打开流:已达到重定向限制,正在中止

我在这个网站上阅读了20多个相关问题,在谷歌搜索但没有用.我是PHP的新手,我正在使用PHP Simple HTML DOM Parser来获取URL.虽然此脚本适用于本地测试页,但它不适用于我需要脚本的URL.

以下是我为此编写的代码,遵循PHP Simple DOM解析器库附带的示例文件:

<?php

include('simple_html_dom.php');

$html = file_get_html('http://www.farmersagent.com/Results.aspx?isa=1&name=A&csz=AL');

foreach($html->find('li.name ul#generalListing') as $e)
echo $e->plaintext;  

?>
Run Code Online (Sandbox Code Playgroud)

这是我得到的错误消息:

Warning: file_get_contents(http://www.farmersagent.com/Results.aspx?isa=1&amp;name=A&amp;csz=AL) [function.file-get-contents]: failed to open stream: Redirection limit reached, aborting in /home/content/html/website.in/test/simple_html_dom.php on line 70
Run Code Online (Sandbox Code Playgroud)

请指导我应该做些什么来使它工作.我是新人,所以请提出一个简单的方法.在阅读本网站上的其他问题及其答案时,我尝试使用cURL方法创建句柄,但是我没能使它工作.我尝试的cURL方法不断返回"资源"或"对象".我不知道如何将它传递给Simple HTML DOM Parser以使$ html-> find()正常工作.

请帮忙!谢谢!

php redirect curl dom simple-html-dom

6
推荐指数
3
解决办法
2万
查看次数

标签 统计

curl ×1

dom ×1

php ×1

redirect ×1

simple-html-dom ×1