Silly question Im using implode('', file($url); in a loop to open pages and check for backlinks. Is there a way to make it only check for 5 seconds and then go to the next $url?
You can use this with safe_mode ON only. if(!ini_get('safe_mode')) { set_time_limit(240); ini_set('max_input_time', 300); } PHP: If Safe Mode is on, then never mind that - I would be helpless. You can check if safe_mode is on, in your php.ini or by using php_info(); PHP:
I dont think that will work. I want to do something like this: while (looping though $urls){ while( <less than 5 seconds or $content is found> ){ $content = implode('', file($url)); } } is there a way to do that?
Well, there's no need to set a time limit, rather than how far microtime() can be delimited. Use something along these lines. $time = microtime(); $startTime = // MICROTIME+HOWLONGFROMTHEN for ($i = $time; $i >= $startTime; $i--): if ($CONTENT) { echo "Something here."; } else { $startTime--; if ($startTime<=0): // Loop went out the back door break; // escape from the for loop } } } PHP:
Look into moving to cURL for retrieving the pages. cURL has among other goodies, connection and read timeout arguments available.
I believe he wants to return an array (file) instead of a string (file_get_contents) which is why he used implode later on in the code.