Re: fsockopen() to remote URL: what if remote URL "times out"?

From: Date: Fri, 10 Jan 2003 11:17:06 +0000
Subject: Re: fsockopen() to remote URL: what if remote URL "times out"?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-131082@lists.php.net to get a copy of this message
"Phil Powell" <soazine@erols.com> 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? Yes, it is the last parameter of the fsockopen() function. Normally, it will be set to something like 30 seconds, you might adjust it to whatever you like. After that time you will get error 110 which means "Connection timed out". Additionally, if you set anything over 30 seconds, you might also consider altering the execution time limit for the php script itself. -- Maxim Maletsky maxim@php.net

« previous php.general (#131082) next »