Need Help-RSS Parser

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
aea
Forum Newbie
Posts: 3
Joined: Fri Aug 28, 2009 6:54 pm

Need Help-RSS Parser

Post 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?
AlanG
Forum Contributor
Posts: 136
Joined: Wed Jun 10, 2009 1:03 am

Re: Need Help-RSS Parser

Post 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
aea
Forum Newbie
Posts: 3
Joined: Fri Aug 28, 2009 6:54 pm

Re: Need Help-RSS Parser

Post 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]
AlanG
Forum Contributor
Posts: 136
Joined: Wed Jun 10, 2009 1:03 am

Re: Need Help-RSS Parser

Post 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.
Post Reply