Rss Parser issue

Hello everyone i’m trying to add a page to my website that allows me to parse feeds from an rss page but for some reason the code i am using only parses 4 topics on the feed and not all the content and part of the code has a javascript file … i will post both files sources … sorry if i’m posting on the wrong forum / thread
[php]<?php

$q=$_GET[“q”];

if($q==Google)
{
$xml=(“http://news.google.com/news?ned=us&topic=h&output=rss”);
}
elseif($q==IBNLive)
{
$xml=(“http://www.ibnlive.com/xml/top.xml”);
}
elseif($q==MSNBC)
{
$xml=(“http://rss.msnbc.msn.com/id/3032091/device/rss/rss.xml”);
}
elseif($q==NDTV)
{
$xml=(“http://feeds.feedburner.com/NdtvNews-TopStories?format=xml”);
}
elseif($q==BBC)
{
$xml=(“http://news.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml”);
}
elseif($q==ZEE)
{
$xml=(“http://www.metacritic.com/rss/games/ps3.xml”);
}

$xmlDoc=new DOMDocument($xml);
$xmlDoc->load($xml);

$channel=$xmlDoc->getElementsByTagName(‘channel’)->item(0);
$channel_title = $channel->getElementsByTagName(‘title’)
->item(0)->childNodes->item(0)->nodeValue;
$channel_link = $channel->getElementsByTagName(‘link’)
->item(0)->childNodes->item(0)->nodeValue;
$channel_desc = $channel->getElementsByTagName(‘description’)
->item(0)->childNodes->item(0)->nodeValue;

//output elements from “”
echo("

" . $channel_title . “”);
echo("
");
echo($channel_desc . “

”);

//get and output “” elements
$x=$xmlDoc->getElementsByTagName(‘item’);
for ($i=0; $i<=2; $i++)
{
$item_title=$x->item($i)->getElementsByTagName(‘title’)
->item(0)->childNodes->item(0)->nodeValue;
$item_link=$x->item($i)->getElementsByTagName(‘link’)
->item(0)->childNodes->item(0)->nodeValue;
$item_desc=$x->item($i)->getElementsByTagName(‘description’)
->item(0)->childNodes->item(0)->nodeValue;

echo ("

" . $item_title . “”);
echo ("
");
echo ($item_desc . “

”);
}
?> [/php]
^ php

[code]var xmlhttp;

function showRSS(str)
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
{
alert (“Your browser does not support XML HTTP Request”);
return;
}
var url=“getrss.php”;
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open(“GET”,url,true);
xmlhttp.send(null);
}

function stateChanged()
{
if (xmlhttp.readyState==4)
{
document.getElementById(“rssOutput”).innerHTML=xmlhttp.responseText;
}
}

function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
return new XMLHttpRequest();
}
if (window.ActiveXObject)
{
// code for IE6, IE5
return new ActiveXObject(“Microsoft.XMLHTTP”);
}
return null;
} [/code]

^ javascript

Any help would be greatly appreciated … i am new to php and this forum but i have been studying alot of php tutorials for awhile now , i believe that you can never learn enough when it comes to php and it is my favorite programming language :slight_smile:

bump

Sponsor our Newsletter | Privacy Policy | Terms of Service