Re: use of fsockopen
| From: | Gerard Samuel | Date: | Wed, 05 Jun 2002 21:15:39 +0000 |
| Subject: | Re: use of fsockopen | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-100806@lists.php.net to get a copy of this message | ||
Oh I forgot to mention that its not writing any content to the cache file...
Gerard Samuel wrote:
Im trying to modify a script that fetches rss newfeeds. I was using fopen, but I decided to use fsockopen() for the timeout value. ---------------------- <?php $data = ''; $filehandle = fsockopen ($sourceurl, 80, $errno, $errstr, 5); if (!$filehandle) { $data = $errstr; } else { while (!feof($filehandle)) {-- Gerard Samuel http://www.trini0.org:81/ http://dev.trini0.org:81/$data .= fgets($filehandle, 1024);} } $cacheFile = fopen( _CACHEDIR. $cacheFile, "w"); fwrite($cacheFile, $data); fclose($cacheFile); fclose($filehandle); ?> --------------------------------------- Does anyone see anything wrong with this code?? Thanks