Am I correct in thinking that the line:
$req = new HTTP_Request($url, array('timeout'=>10));
is supposed to set a time limit of 10 seconds when $req->sendRequest() is called?
That is correct. The only gotcha there is that the timeout parameter only applies to connection time. You can also set a read timeout, like this:
$params['timeout'] = 2;
$params['readTimeout'] = array(8, 0);
$req = new HTTP_Request($url, $params);
I separated out the parameters to make it more readable. That sets a connection timeout of 2 seconds and a read timeout of 8 seconds.
Is there a test I can use to say, "okay, if this request takes more than xx seconds, get the next $url to test"?
You mean something generic that you could apply to any function? Nothing that I know of. Sounds useful though. 🙂
My Error:
Non Fatal PHP Error: (2) fsockopen(): unable to connect to 165.2.141.65:80 at D:\php\pear\Net\Socket.php line 106
It's bombing on this url: http://www.bristolhotels.com/
Not surprised it can't get bristolhotels.com, since my web browser also times out on it. Anyway, it does say this is a non fatal error. Your script shouldn't have stopped executing just for this. Perhaps it coincided with the script timeout?
I noticed earlier you said you had set script execution to 200 seconds. With 4,800 urls to hit, that means each url has to finish in under 0.05 seconds. I think you may need to try less urls or give it more time to do them.
By the way, instead of doing ini_set you might want to look at the set_time_limit function.