Socket timeout best practices

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Shabang
Forum Newbie
Posts: 1
Joined: Thu Feb 23, 2006 2:01 am

Socket timeout best practices

Post 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)?
Post Reply