How to re-use an RSS feed?

booksgo

New Member
Messages
109
Reaction score
0
Points
0
I have access to an RSS feed, (eg www.booksgo's_other_site.com/rssfeed.rss) that I want to make available at booksgo.x10hosting.com/feed.rss
I don't want the url to re-direct, I want the feed to be imported somehow and on the x10 server at booksgo.x10hosting.com/feed.rss.
Is that sort of thing possible, any ideas?
Thanks
 

arunproff

New Member
Messages
9
Reaction score
1
Points
0
There are a couple of ways of doing this.

Option 1.
Run a cron-job on the server and call a shell script to get the file from the other site and store it in your public_html folder as feed.rss. I'm not sure if x10hosting allows wget or commands like that, but you can check.

Or

Option 2.
Write a PHP/Python script which fetches and displays the RSS feed each time feed.rss is called. You can do that using a Apache .htaccess RewriteRule such that any access to feed.rss will call your script.
 

worldwise001

Member
Messages
57
Reaction score
1
Points
8
As far as I know, external access from x10 is not allowed, although I may be wrong.
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
First, you want to grab the other rss feed. cURL library is nice.

PHP online manual

Example of using cURL

rss.php

PHP:
   // create curl resource 
 $ch = curl_init(); 

        // set url 
 curl_setopt($ch, CURLOPT_URL, "www.booksgo's_other_site.com/rssfeed.rss"); 

        //return the transfer as a string 
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 

        // $output contains the output string 
 $output = curl_exec($ch); 

        // close curl resource to free up system resources 
 curl_close($ch);


Then you want to spit it out.

PHP:
  header('Content-type: text/xml');

 echo $output ;

"But that has .php extension. I want an .rss extension!" :eek4:

Ok. Add the folowing to .htaccess in the directory of your choice so it will rewrite the incoming URL 'feed.rss' to rss.php.

Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} feed.rss$ [NC]
RewriteRule ^feed.rss$ rss.php
</IfModule>
 

booksgo

New Member
Messages
109
Reaction score
0
Points
0
Thanks for your help. There was a problem with an '&', but it doesn't matter now as I've gone off the idea :)
 

pro1337

New Member
Messages
7
Reaction score
0
Points
0
If you need more help with php, html, Rss or eany thing else ust pm me I will help with all :)
 
Top