2014-07-04 40 views
0

我有问题。我正在写一个应该使用file_get_contents函数的php脚本。file_get_contents无法打开只有多个流

和它的作品太棒了,当我使用它在我的脚本只是一次它的工作太棒了,我没有得到任何错误,但如果我实现它更多然后一旦我得到休耕错误

警告:的file_get_contents( (ddl“%cge,add` $ Cbe &)[function.file-get-contents]:无法打开流:没有这样的文件或目录在/home/content/34/9587634/html/WebSite.Com/userarea123/上线85 urlupload.php过滤HTML:页面标题:晴海寿司

所以这里是我的代码作为例子

$url1 = "http://www.dogpile.com"; 
$url2 = "http://www.google.com"; 

$Test1= file_get_contents($url1); 
echo $Test1; 

$Test2= file_get_contents($url2); 
echo $Test2; 

我不确定会造成这个问题,我一直无法找到任何文件,为什么有多个file_get_contents会错误我的脚本。

所有帮助表示赞赏 非常感谢你

+1

问题不在于有多个文件open..it在URL(http://www.dogpile.com)..的 – Ezhil

+0

可能重复[为什么我使用file \ _get \ _contents()时出现500错误,但在浏览器中工作?](http://stackoverflow.com/questions/10524748/why-im-getting-500-error-when-using- file-get-contents-but-works-in-a-browser) – kenorb

回答

0

是的,这不是多次调用的问题,但与dogpile.com。他们可能有某种保护措施 - 他们正在检测浏览器并基于此提供不同的内容。尝试使用curl库,并模仿一些浏览器:

http://www.php.net/manual/en/book.curl.php

+1

你也可以在file_get_contents的上下文中模拟浏览器(设置用户代理头) –

相关问题