|
|
|
> I am using fsock_open,fputs,fgets to do
> an http request from within a phtml script.
>
> Question: Is there a way to time out, to
> prevent fgets hanging, in case the response
> never came?
See: http://ca.php.net/manual/function.set-socket-blocking.php3
Or look at the description below :
set_socket_blocking
set_socket_blocking -- Set blocking/non-blocking mode on a socket
Description
int set_socket_blocking(int socket descriptor, int mode);
If mode is false, the given socket descriptor will be switched to non-blocking
mode, and if true, it will be switched to blocking mode. This affects calls
like fgets() that read from the socket. In non-blocking mode an fgets() call
will always return right away while in blocking mode it will wait for data to
become available on the socket.
|
|
| Query2Report : Generating Html, Pdf and Csv Reports from SQL Query Categories : PHP, PHP, HTML, PDF, Excel | | | JDToGregorian -- Converts Julian Day Count to Gregorian date Categories : PHP, PHP Functions, Calendar | | | Encoding data using PGP via PHP's proc_* functions Categories : Cryptography, Security, Email, PHP, PGP | | | Variable serialization and unserialization. Loading and saving variable structures
to and from file. Categories : Arrays, Filesystem, Variables, Strings, PHP | | | Free PDF file creation using PHP. Categories : PDF, PHP | | | How to get the name of the user which is accessing
the current script. Categories : Environment Variables, PHP | | | PHP4 MYSQL Authentication Script with cookie. Short & Sweet
Categories : Authentication, Apache, Cookies, PHP, MySQL | | | Latitude-Longitude to Miles Categories : PHP, Utilities, Math. | | | Message of the Day - Random Message (Needs MySQL!) Categories : Databases, HTML and PHP, PHP, MySQL | | | Extract keywords from a string having words in " " count as one string. Categories : PHP, Strings, Regexps, Search | | | Retrieve text from table and email to your e-
address in pipe delimited format. Categories : PHP, MySQL | | | SAPIPROCESSOR - is a compact XML-based CMS toolkit Categories : PHP, Content Management, XML | | | Accepts a database & hostname from a user and then HTTP username and password. Uses this to connect to a MySQL database. Produces a form based on the tables it finds there to allow the user to do SELECTs, INSERTs, and DELETEs. Categories : Databases, PHP, MySQL, Complete Programs | | | MySQL database class Categories : PHP, MySQL, Databases, PHP Classes | | | Using $PHP_AUTH_USER and $PHP_AUTH_PW to authenticate. Categories : Authentication, PHP | |
|
|