Hello,
I have a script that parses XML file.
This script works perfectly in one server and but shows the following error in the other server :
Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ')' in /file.php on line 9
My PHP code is below :
<?php
$doc = new DOMDocument();
$doc->load('feed.xml');
$arrFeeds = array();
$count = 0;
foreach ($doc->getElementsByTagName('item') as $node)
{
$itemRSS = array ('id' => $node->getElementsByTagName('id')->item(0)->nodeValue, 'name' => $node->getElementsByTagName('name')->item(0)->nodeValue);
array_push($arrFeeds, $itemRSS);
$count = $count + 1;
}
for($i = 0; $i < $count; $i++)
{
echo $arrFeeds [$i]['id'];
echo "<br>";
echo $arrFeeds [$i]['name'];
echo "<br>";
}
?>
The server that runs the script well is with PHP 5 and the one that gives error is PHP 4.9.
Not sure if the version can cause this problem.
Please guide me. i need to run this in both the servers.