473,395 Members | 1,583 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

error T_OBJECT_OPERATOR

Hello dear members,
I am displaying the online news through rss feed in my portal, it is working good enough on localhost WAMP but when i upload the script on our USA based Linux Server I m having the error as below,

T_OBJECT_OPERATOR ,

Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /home/stocksli/public_html/getrss.php on line 23

on the line :
$channel = $xmlDoc->getElementsByTagName('channel')->item(0);

The whole script is as below.

<?php
//get the q parameter from URL
//$q=$_GET["q"];

//find out which feed was selected
/*if($q=="Google")
{
$xml=("http://news.google.com/news?ned=us&topic=h&output=rss");
}
elseif($q=="MSNBC")
{
$xml=("http://rss.msnbc.msn.com/id/3032091/device/rss/rss.xml");
}
*/

//$xml=("http://moneycontrol.com/rss/business.xml");

$xml=("http://moneycontrol.com/rss/business.xml");
$xmlDoc = new DOMDocument() or die("Oops Object Not Created");;
$xmlDoc->load($xml) or die("Problem Downloading The XML file");;

//get elements from "<channel>"
$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 "<channel>"
echo("<p align='center'><font size='-20'><a href='" . $channel_link . "'>" . $channel_title . "</a>");
echo("<br />");
echo($channel_desc . "</font></p>");

//get and output "<item>" elements
$x=$xmlDoc->getElementsByTagName('item');
for ($i=0; $i<=4; $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 ("<p><a href='" . $item_link . "'>" . $item_title . "</a>");
echo ("<br />");
echo ($item_desc . "</p>");
}
//echo "<p align='right'><a href='" . $channel_link . "'>more news ....</a></p>";

?>

PLEASE GIVE ME SOLUTION IF KNOWN.
Mar 27 '08 #1
1 1835
Markus
6,050 Expert 4TB
When using this forum, use the code=xxx tags [you can read about them in the forum guidelines].

What PHP version does your live server use?
Mar 27 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: sky2070 | last post by:
Parse error: parse error, unexpected T_OBJECT_OPERATOR, expecting ')' in c:\inetpub\wwwroot\session.php on line 19 can anyone tell me what is wrong with this code??? <? // Define the Session...
4
by: bugs | last post by:
<? class foo { var $value; var $child = array(); function setChild($ch) { array_push($this->child,$ch); }
2
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two...
5
by: Tony Wright | last post by:
Hi, I am having a problem installing an msi for a web site. The error message I am getting is: "The specified path 'http://mipdev05/features/Fas2' is unavailable. The Internet Information...
13
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
7
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
5
by: devereaux | last post by:
I'm trying to run a script and it's throwing the following error: Parse error: syntax error, unexpected T_OBJECT_OPERATOR in openfile.php on line 41 Here is the openfile.php file and I have...
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.