[nycphp-talk] fopen wrappers and timeouts
zaunere at yahoo.com
Wed Feb 19 14:27:30 EST 2003
--- Chris Snyder <chris at psydeshow.org> wrote:
> Hi folks, does anyone know of a way to cause something like
> fopen("http://example.com/") to time out after, say 5 seconds?
Best use fsockopen():
$fp = fsockopen('example.com',80,$errno,$errstr,5);
Which would try to connect to example.com on port 80 with a timeout of 5
seconds, writing any error code or string to $errno or $errstr, respectively.
More information about the talk