note 70667 added to function.date

From: Date: Mon, 23 Oct 2006 15:13:32 +0000
Subject: note 70667 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-119023@lists.php.net to get a copy of this message
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. Article at http://www.xorath.com/articles/?article=2 ---- Server IP: 129.16.214.50 Probable Submitter: 213.112.125.120 ---- Manual Page -- http://www.php.net/manual/en/function.date.php Edit -- https://master.php.net/note/edit/70667 Del: integrated -- https://master.php.net/note/delete/70667/integrated Del: useless -- https://master.php.net/note/delete/70667/useless Del: bad code -- https://master.php.net/note/delete/70667/bad+code Del: spam -- https://master.php.net/note/delete/70667/spam Del: non-english -- https://master.php.net/note/delete/70667/non-english Del: in docs -- https://master.php.net/note/delete/70667/in+docs Del: other reasons-- https://master.php.net/note/delete/70667 Reject -- https://master.php.net/note/reject/70667 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#119023) next »