Jump to content

How to timeout php functions


Andrew R

Recommended Posts

Hi there. 

 

How do I stop a function from running it it's taking to long to proccess.  For example, say after 10 seconds the code is still working I display an error message?  As you can in the following code it's pulling the contents from an url or file which might take too long to load.

 

function Tester($url);
{

return file_get_contents($url);

}

 

 

Thanks a mil

 

 

Link to comment
https://forums.phpfreaks.com/topic/216917-how-to-timeout-php-functions/
Share on other sites

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.