Jump to content

getting some operator error


pouncer

Recommended Posts

Parse error: parse error, unexpected T_OBJECT_OPERATOR in c:\domains\interzurf.nl\wwwroot\socialnetwork\GetSearchResults\GetSearchResults.php on line 72

line 72 is this

$code = $errors->item(0)->getElementsByTagName('ErrorCode');

(this is a ebay file, im using this ebay api stuff to display ebay items on my site)
Link to comment
Share on other sites

The error message tells where the php interpreted choked, not necessarily where the error originated.  Start by showing us the ten or so lines leading up to your line 72 and chances are one of those is where you have a syntax error.
Link to comment
Share on other sites

Well this is the whole page. The line is near the middle where it checks for errors

[code]
<?php require_once('keys.php') ?>
<?php require_once('eBaySession.php') ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<TITLE>GetSearchResults</TITLE>
</HEAD>
<BODY>
<FORM action="GetSearchResults.php" method="post">
<TABLE cellpadding="2" border="0">
<TR>
<TD>Query:</TD>
<TD><INPUT type="text" name="Query"></TD>
</TR>
<TR>
<TD colspan="2" align="right"><INPUT type="submit" name="submit" value="Search"></TD>
</TR>
</TABLE>
</FORM>

<?php
if(isset($_POST['Query']))
{
//Get the query entered
$query = $_POST['Query'];
//set the number of results to return per call
$maxResults = 15;
//set the number of results to skip before starting to return results
//used for paginated results (if MaxResults=15 then:  0 = page 1, 15 = page 2, ....)
$skip = 0;
//whether or not to search in description fields of items (0 = no, 1 = yes)
$searchInDescription = 0;


//SiteID must also be set in the Request's XML
//SiteID = 0  (US) - UK = 3, Canada = 2, Australia = 15, ....
//SiteID Indicates the eBay site to associate the call with
$siteID = 0;
//the call being made:
$verb = 'GetSearchResults';

///Build the request Xml string
$requestXmlBody = '<?xml version="1.0" encoding="utf-8" ?>';
$requestXmlBody .= '<GetSearchResultsRequest xmlns="urn:ebay:apis:eBLBaseComponents">';
$requestXmlBody .= "<RequesterCredentials><eBayAuthToken>$userToken</eBayAuthToken></RequesterCredentials>";
$requestXmlBody .= "<Query>$query</Query>";
$requestXmlBody .= '</GetSearchResultsRequest>';

//Create a new eBay session with all details needed, CompatabilityLevel = 433 and using the test server
$session = new eBaySession($userToken, $devID, $appID, $certID, false, 433, $siteID, $verb);

//send the request and get response
$responseXml = $session->sendHttpRequest($requestXmlBody);
if(stristr($responseXml, 'HTTP 404') || $responseXml == '')
die('<P>Error sending request');

//Xml string is parsed and creates a DOM Document object
$responseDoc = new DomDocument();
$responseDoc->loadXML($responseXml);


//get any error nodes
$errors = $responseDoc->getElementsByTagName('Errors');

//if there are error nodes
if($errors->length > 0)
{
echo '<P><B>eBay returned the following error(s):</B>';
//display each error
//Get error code, ShortMesaage and LongMessage
$code = $errors->item(0)->getElementsByTagName('ErrorCode');
$shortMsg = $errors->item(0)->getElementsByTagName('ShortMessage');
$longMsg = $errors->item(0)->getElementsByTagName('LongMessage');
//Display code and shortmessage
echo '<P>', $code->item(0)->nodeValue, ' : ', str_replace(">", "&gt;", str_replace("<", "&lt;", $shortMsg->item(0)->nodeValue));
//if there is a long message (ie ErrorLevel=1), display it
if(count($longMsg) > 0)
echo '<BR>', str_replace(">", "&gt;", str_replace("<", "&lt;", $longMsg->item(0)->nodeValue));

}
else //no errors
{
//get results nodes
$itemNodes = $responseDoc->getElementsByTagName('Item');

//see if there are any results
if($itemNodes->length > 0)
{
?>
<TABLE cellpadding="6" cellspacing="0" border="0">
<TR bgcolor="#BBBBBB">
<TD><B>Id</B></TD>
<TD><B>Title</B></TD>
<TD><B>Price</B></TD>
<TD><B>Started</B></TD>
<TD><B>Ends</B></TD>
</TR>
<?php
//stores the alternationg background colour of the rows
$bgColor = "#FFFFFF";
//go through each result
foreach($itemNodes as $item)
{
//get the required nodes from the results
$itemID = $item->getElementsByTagName('ItemID');
$title = $item->getElementsByTagName('Title');
$price = $item->getElementsByTagName('CurrentPrice');
$startTime = $item->getElementsByTagName('StartTime');
$endTime = $item->getElementsByTagName('EndTime');
$link = $item->getElementsByTagName('ViewItemURL');
//display the result in a table row
?>
<TR bgcolor="<?php echo $bgColor ?>">
<TD><?php echo $itemID->item(0)->nodeValue; ?></TD>
<!-- Display the Title as a link to the item on eBay -->
<TD><A href="<?php echo $link->item(0)->nodeValue; ?>" target="_blank">
<?php echo $title->item(0)->nodeValue; ?>
</A>
</TD>
<TD><?php echo $price->item(0)->nodeValue; ?></TD>
<TD><?php echo $startTime->item(0)->nodeValue; ?> GMT</TD>
<TD><?php echo $endTime->item(0)->nodeValue; ?> GMT</TD>
</TR>
<?php
//alternate the background colours
$bgColor = $bgColor == "#FFFFFF" ? "#EEEEEE" : "#FFFFFF";
} ?>
</TABLE>
<?php
}
else
{
echo '<P><B>No items found</B>';
}
}
}
?>

</BODY>
</HTML>
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.