Page 1 of 1

Socket timeout best practices

Posted: Thu Feb 23, 2006 2:06 am
by Shabang
How do I set a socket timeout with fopen or file_get_contents methods?

In one of my pages I fetch information from a 3rd party site. If this site hangs or god frobids does not respond at all - my page also hangs until the default socket t/o.

I would like to set a shorter t/o for this request only - what's the best practice to do so if I use fopen (or file_get_contents for that matter)?