[nycphp-talk] fsockopen to remote URL: what if remote URL "times out"?
Adam Fields
fields at surgam.net
Fri Jan 10 09:47:13 EST 2003
On Fri, Jan 10, 2003 at 03:20:48AM -0500, Phil Powell wrote:
> I have a question about the usage of fsockopen() to open and "scrape" the contents of a remote URL: if the contents take a very long time to load on the remote URL either due to server or coding issues, is there a way for the socket on the PHP end to time out, that is, quit trying to "scrape" contents from the remote site and post a default message instead?
>
There are two ways to do this. You can specify a timeout value as the
fifth arg to fsockopen. This is the timeout for the connection
itself. You can also use stream_set_timeout once the socket is open.
--
- Adam
-----
Adam Fields, Managing Partner, fields at surgam.net
Surgam, Inc. is a technology consulting firm with strong background in
delivering scalable and robust enterprise web and IT applications.
http://www.adamfields.com
More information about the talk
mailing list