note 70667 modified in function.date by danbrown
| From: | danbrown@php.net | Date: | Mon, 20 Jun 2011 14:54:43 +0000 |
| Subject: | note 70667 modified in function.date by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-180696@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.
--was--
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
http://php.net/manual/en/function.date.php