If you are trying to parse an “XML Feed” in PHP4 somewhat like this way :
$titles->item(0)->nodeValue;
then it wont work in PHP4 because its a chaining process and only works in PHP5
If you are trying to parse an “XML Feed” in PHP4 somewhat like this way :
$titles->item(0)->nodeValue;
then it wont work in PHP4 because its a chaining process and only works in PHP5
March 18, 2008 at 8:48 am |
Well is there any alternative?
March 18, 2008 at 6:44 pm |
Well I too was trying for the same but cudnt find a solution so I think the possible solution would be to upgrade your PHP version to php5.
July 21, 2008 at 6:55 am |
i have error in RSS
ERROR: Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /home/sunkickc/public_html/dev/dipak/210608dipak_system/indiasquare/News/general.php on line 20
give me suggetion what i am doing
Scrip:load(‘http://news.google.co.in/nwshp?tab=in&ned=in&topic=n&output=rss’);
//get elements from “”
$channel=$xmlDoc->getElementsByTagName(‘channel’)->item(0);
$title->item(0)->nodeValue;
$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 “”;
$x=$xmlDoc->getElementsByTagName(‘item’);
for ($i=0; $iitem($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 ($item_desc);
// echo (“” . $item_title . ““);
echo (“”);
// echo ($item_desc . “”);
}
echo “”;
?>
April 11, 2009 at 6:43 pm |
Old post, but for the benefit of those who may visit this site in the future… The solution is to break down the chain call into two calls:
xtemp = $titles->item(0);
xrealVar = xtemp ->nodeValue;
But it’s 2009, I would upgrade to php 5 if possible to take advantage of some of the new features
April 30, 2009 at 10:00 pm |
thanks to verboze for this solution…
I have one server with php5 and one with php4 – and need my scripts to work on both servers – Im not in a position to upgrade the one running php4 at this time – its too disruptive.. and I needed a temp workaround for now
this did the job…