PHP file_get_contents very slow when using full url

Scoot

New Member
I am working with a script (that I did not create originally) that generates a pdf file from an HTML page. The problem is that it is now taking a very long time, like 1-2 minutes, to process. Supposedly this was working fine originally, but has slowed down within the past couple of weeks.The script calls file_get_contents on a php script, which then outputs the result into an HTML file on the server, and runs the pdf generator app on that file.I seem to have narrowed down the problem to the file_get_contents call on a full url, rather than a local path.When I use\[code\]$content = file_get_contents('test.txt');\[/code\]it processes almost instantaneously. However, if I use the full url\[code\]$content = file_get_contents('http://example.com/test.txt');\[/code\]it takes anywhere from 30-90 seconds to process.It's not limited to our server, it is slow when accessing any external url, such as http://www.google.com. I believe the script calls the full url because there are query string variables that are necessary that don't work if you call the file locally.I also tried fopen, readfile, and curl, and they were all similarly slow. Any ideas on where to look to fix this?
 
Back
Top