Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -------------------------
- PHP file to host anywhere
- -------------------------
- <?php
- //Set your time zone
- date_default_timezone_set('Europe/Madrid');
- //File where items will be stored
- $archivo ='https://dl.dropboxusercontent.com/..../RSS/feed.txt';
- $str1 = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>
- <rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">
- <channel>
- <title>Your feed</title>
- <link>http://..../feed.xml</link>
- <description>Shared RSS</description>
- <language>es-es</language>
- \r\n<atom:link href=\"http://..../feed.xml\" rel=\"self\" type=\"application/rss+xml\" />";
- $str11 = "\r\n<lastBuildDate>".date('D, d M Y H:i:s O')."</lastBuildDate>\r\n";
- $str2 = file_get_contents("$archivo");
- $str3 = "\r\n</channel></rss>";
- $result = $str1 . $str11 . $str2 . $str3;
- $xml1 = preg_replace('#&(?=[a-z_0-9]+=)#', '&', $result);
- $xml = new SimpleXMLElement($xml1);
- foreach ($xml->channel->item as $item) {
- $pubdate = $item->pubDate;
- if (($timestamp = strtotime(str_replace(" at "," ",$pubdate))) === false) {
- $conv = date(DATE_RSS);
- } else {
- $conv = date(DATE_RSS, strtotime(str_replace(" at "," ",$pubdate)));
- }
- $item->pubDate = $conv;
- }
- // Stores resultant XML file
- $xml->asXML ( '/home/..../public_html/feed.xml' );
- //Shows XML on screen
- echo $xml->asXML();
- ?>
- ------------------------------
- TEXT for the recipe content
- ------------------------------
- <item><br/>
- <title>{{ArticleTitle}}</title><br/>
- <link>{{ArticleURL}}</link><br/>
- <description>
- <![CDATA[
- {{ArticleContent}}
- ]]>
- </description><br/>
- <source url="{{SourceURL}}"> {{SourceTitle}}</source><br/>
- <pubDate>{{ArticlePublishedAt}}</pubDate><br/>
- </item><br/>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement