Here's the simplest way to implement that.
<?php
$timeout = 3;
$old = ini_set('default_socket_timeout', $timeout);
$file = fopen('http://example.com', 'r');
ini_set('default_socket_timeout', $old);
stream_set_timeout($file, $timeout);
stream_set_blocking($file, 0);
//the rest is standard
?>
Another posts included in "PHP"
| How to limit by Timeout when opening URL ? (0) | 2008/04/14 |
| ASCII Artwork Generator from image file (0) | 2008/09/23 |
| How to delete file on certain path ? (0) | 2008/10/01 |
| How to convert W3C Date Time Format ? (0) | 2008/02/28 |
| Get the actual filesize for a size above 2GB in Windows (0) | 2008/02/24 |
| ISO 8601 format time format string conversion (0) | 2008/02/13 |
| How to download a file from a certain URL to server ? (0) | 2008/01/21 |
| How to extract file name from given URL ? (0) | 2008/01/21 |

Prev

Rss Feed