0

I am having an issue. I am writing a php script that is supposed to use the file_get_contents function.

And It works fantastic, When I use it in my script just once it works fantastic and I don't get any error but if I implement it more then once I get the fallowing error

Warning: file_get_contents((ddl"%cge,add`$Cbe&) [function.file-get-contents]: failed to open stream: No such file or directory in /home/content/34/9587634/html/WebSite.Com/userarea123/urlupload.php on line 85 Filtered HTML: Page Title: Harumi Sushi

so here is my code as a example

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

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

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

I am not sure what would be making this issue I have not been able to find any documentation on why having multiple file_get_contents would error out my script.

All help is appreciated Thank You very much

user206390
  • 55
  • 7
  • 1
    the problem is not with multiple file open..it is in url(http://www.dogpile.com).. – Ezhil Jul 04 '14 at 06:42
  • possible duplicate of [Why I'm getting 500 error when using file\_get\_contents(), but works in a browser?](http://stackoverflow.com/questions/10524748/why-im-getting-500-error-when-using-file-get-contents-but-works-in-a-browser) – kenorb Mar 16 '15 at 17:55

1 Answers1

0

Yes, it's not the problem with multiple calls, but with dogpile.com. They probably have some kind of protection - they are detecting browser and delivering different content based on that. Try using curl library and emulating some browser:

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

MilanG
  • 6,994
  • 2
  • 35
  • 64