davidfrey wrote in php

Listens: Tripping Billies

Remote file timeout

I'm struggling with a problem that involves opening a remote file that I need to parse on each page load. Occasionally the remote file is unavailable due to network problems or server load on the remote machine. I've used fsockopen() successfully in the past when the remote's entire hostname is unavailable, but lately I'm having problems connecting to the file itself due to server load. I need to set a timeout on accessing the specific file so it doesn't delay the rest of the script from running and allow the page to finish loading.

Does anyone have any suggestions? I've considered using set_time_limit(), but I don't think that will solve anything.