note 70667 deleted from function.date by tularis

From: Date: Thu, 09 Feb 2012 21:03:28 +0000
Subject: note 70667 deleted from function.date by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-186022@lists.php.net to get a copy of this message
Note Submitter: admin [at] xorath [dot] com ---- If you want to use the date function to fix the RFC-822 format from an allready made RSS 2.0 feed you can do it like this.. Maybe getting an external feed from another asp or php file that you cannot change, but want to have the correct dateformat for anyway. <?php header('Content-type: application/rss+xml; charset=iso-8859-1'); $xmlfile = simplexml_load_file($_GET[feedURL]); for ( $i = 0; $i < count($xmlfile->channel->item); $i++ ) $xmlfile->channel->item[$i]->pubDate = date("r",strtotime((string)($xmlfile->channel->item[$i]->pubDate))); echo $xmlfile->asXML(); ?> Then simply link to your rss feed like this filename.php?feedURL=http://www.example.com/rss.asp filename.php?feedURL=http://www.example.com/rss.xml filename.php?feedURL=http://www.example.com/rss.php or what you want. Hope anyone can take advantage of this, I wrote it to help a friend which had date stored in database only by yyyy-mm-dd hh:mm:ss and retrieved via asp from another script.

« previous php.notes (#186022) next »