Forum

Common Readed, feed as a URL

2010-04-08 22:34:46

wattaman

I was wondering if I can use commonlib (or the other feed readers) by adding the feed address in the commonlib URL, when browsing. Example: example.com/commonlib.php?url-of-the-feed=feed.com/rss Thank you!
2010-04-09 12:23:25

scriptol

You have to had an extra layer to get the parameter, and call the display function.
$url = $_POST['feed'];
include_once("commonlib.php");  // or rsslib
display($url);
The code is simplified.
2010-04-10 22:53:49

wattaman

You have to had an extra layer to get the parameter, and call the display function.
$url = $_POST['feed'];
include_once("commonlib.php");  // or rsslib
display($url);
The code is simplified.
Sorry, can't make it work. I'm not a coder myself, I don't get the meaning of "simplified" - if I must change something then I'm already lost :) Could you be more specific, please? So far I have a test file with this code:
<?php
$url = $_POST['feed'];
include_once("commonlib.php");  // or rsslib
display($url);
?>
... and this message:
Fatal error: Call to undefined function display() in D:\XAMPP\htdocs\commonlib\test.php on line 19
(testing locally on Xampp), on this URL: localhost/commonlib/test.php?url=my.feed.URL Maybe I haven't explained myself very good in the first thread, sorry. So, seeing my test link, this is what I want. Also, I don't mind if I must use another file, like test.php, or the commonlib.php itself in the address. What I want to do (the big story) is to allow site's visitors to preview the site feeds, staying on the same address, before they'll decide to subscribe to that feed. The test.php page will have a drop-down menu with all the feeds and when changed, a new test.php page will load with a new feed from the drop-down menu - this is the easy part... the hard part I hope you'll help me with :) Thanks!
2010-04-12 07:52:40

scriptol

Sorry, it was just an example... Here is the complete code:
<?php
include_once("commonlib.php");
$url = $_GET['feed'];
echo Common_Display($url, 25, true, true, true);
?>
Put the code in a text file, for example rssget.php, in the same directory that commonlib.php. To try the code on wamp, the command is:
http://localhost/commonlib/rssget.php?feed=https://www.scriptol.com/rss.xml
Replace http://localhost by your domain and add the the directory of commonlib. Replace https://www.scriptol.com/rss.xml by the feed to display. Exemple:
http://www.somedomain.org/commonlib/rssget.php?feed=http://www.somedomain.orgrss.xml
For rsslib, replace Common_Display($url, 25, true, true, true); by echo RSS_Display($url, 15);
2010-04-12 09:31:09

wattaman

Thank you very much! You're my hero :) One suggestion, I don't dare to ask only for me, but I think it will improve your script a lot: maybe you can try to make so that it can cache the feeds for a while, making the page to load faster this way. Thanks again!