Re: How can i only fetch a (rss/atom) feed when it's changed?

From: Date: Wed, 03 Oct 2007 18:45:49 +0000
Subject: Re: How can i only fetch a (rss/atom) feed when it's changed?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-262701@lists.php.net to get a copy of this message
On 10/3/07, Greg Donald <greg@cyberfusionconsulting.com> wrote: > > cat fsockopen.php > #!/usr/bin/env php > <?php > > $fp = fsockopen( 'destiney.com', 80, $errno, $errstr, 30 ); > > if( !$fp ) > { > echo "$errstr ($errno)\n"; > } > else > { > $out = "GET /rss HTTP/1.1\r\n"; > $out .= "Host: destiney.com\r\n"; > $out .= "Connection: Close\r\n\r\n"; > > fwrite( $fp, $out ); > > while( !feof( $fp ) ) > echo fgets( $fp, 128 ); > > fclose( $fp ); > } > > This particular request currently yields this Last-Modified header: > > Last-Modified: Fri, 21 Sep 2007 12:45:38 GMT > > This will let you develop a local cache for the rss contents and > only update it when the remote file has changed. i'm not sure that will work. since the feed is dynamically generated, depending on how it is setup it would say it's new all the time, or the modified date would be 1997 or something old to help force a non-caching behavior. could also depend on the script generating the feed...

« previous php.general (#262701) next »