Page 1 of 1

Need Help-RSS Parser

Posted: Fri Aug 28, 2009 7:28 pm
by aea
I am trying to add an RSS feed to my existing PHP page. I am getting this error when I attempt to load my page.
Error: URL missing.

This is the code in my php file:
<?php


error_reporting(0);

print "<link rel='stylesheet' href='rsslib.css' type='text/css'>\n";
include_once("rsslib.php");
$url=$_GET['rss_url'];
if(!$url)
print "Error: URL missing!";
else {
$m=$_GET['rss_items'];
if(!$m) $m=0;
$ch=$_GET['rss_chars'];
if(!$ch) $ch=0;
$t=$_GET['rss_target'];
if(!$t) $t="_blank";
$css=$_GET['rss_css'];
if(!$css) $css="rsslib";
rss2html($url,$m,$ch,$t,$css);
}
?>[/color]

Any ideas why this is not working?

Re: Need Help-RSS Parser

Posted: Sat Aug 29, 2009 8:22 am
by AlanG
Well based on the code, you need to append the rss feed's url to the url of the current script.

eg. index.php?rss_url=www.google.ie

Re: Need Help-RSS Parser

Posted: Mon Aug 31, 2009 10:34 pm
by aea
$url=$_GET['rss_url'];
So are you saying in this line within the code substitue within the "[]" brackets
$url=$_BET[index.php?rss_url=www.google.ie]

Re: Need Help-RSS Parser

Posted: Tue Sep 01, 2009 7:54 am
by AlanG
aea wrote:$url=$_GET['rss_url'];
So are you saying in this line within the code substitue within the "[]" brackets
$url=$_BET[index.php?rss_url=www.google.ie]
No

Code: Select all

$url=$_GET['rss_url'];
if(!$url)
print "Error: URL missing!";
You are using a GET variable. if you go to the current script but append "?rss_url=www.google.com" to it, it will attempt to read http://www.google.com as an rss feed (it will fail though). The reason you are getting an Error: URL missing! is because you are not providing an rss feed's url for the script to work with. If it still fails, use a valid rss feed.