[nycphp-talk] fopen wrappers and timeouts

Hans Zaunere zaunere at
Wed Feb 19 14:27:30 EST 2003

--- Chris Snyder <chris at> wrote:
> Hi folks, does anyone know of a way to cause something like 
> fopen("") to time out after, say 5 seconds?

Best use fsockopen():

$fp = fsockopen('',80,$errno,$errstr,5);

Which would try to connect to 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 mailing list