Jump to content

Delay when retrieving url using file_get_contents


BrizRobbo

Recommended Posts

Hi Folks,

 

I'm using the file_get_contents function to retrieve the contents from a URL. Something like:

 

<?php
echo date('h:i:s')."\n"; //TIMESTAMP -START
$contents = file_get_contents("http://lasun122/index.html");
print "$contents\n";
echo date('h:i:s')."\n"; //TIMESTAMP -END
print "FINISHED\n";
?>

 

It gets all the contents of that URL successfully, then prints it out successfully. The time between the 2 timestamps is typically less than 1 second. However, there always is about a 5 second delay before the program finishes and I get back to the shell prompt. It doesn't matter what web server I'm trying to hit, the delay is always there.

 

Does anyone have any idea what might cause this delay?

 

Cheers.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.