All pastes #78973 Raw Edit

Something

public text v1 · immutable
·published 2006-07-04 19:24 UTC
rendered paste body
<?php require_once('variables.php') ?>
<?php require_once('functions.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>GeteBayDetails</TITLE>
</HEAD>
<BODY>
<?php
//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 = 2;
//the call being made:
$verb = 'GetSearchResults';
//Regulates versioning of the XML interface for the API
$compatabilityLevel = 427;

//get an array of strings containing the required headers
$headers = buildEbayHeaders($devID, $appID, $certID, $compatabilityLevel, $siteID, $verb);

$xml = '<?xml version="1.0" encoding="utf-8"?>';
$xml .= '<GeteBayDetailsRequest xmlns="urn:ebay:apis:eBLBaseComponents">';
$xml .= '<ErrorLanguage>en_CA</ErrorLanguage>';
$xml .= '<WarningLevel>High</WarningLevel>';
$xml .= '</GeteBayDetailsRequest>';
$responseXml = sendHttpRequest($requestXmlBody, $serverUrl, $headers);
if(stristr($responseXml, 'HTTP 404') || $responseXml == '')
	die('<P>Error sending request');

//Xml string is parsed and creates a DOM Document object
$responseDoc = domxml_open_mem($responseXml);

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

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

}
else //no errors
{
	//NEED TO DISPLAY HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	
}
?>

WHAT SHOULD RETURN SHOULD LOOK LIKE THIS: 
<?xml version="1.0" encoding="utf-8"?>
<GeteBayDetailsResponse xmlns="urn:ebay:apis:eBLBaseComponents">
  <!-- Standard Output Fields -->
  <Ack> AckCodeType </Ack>
  <Build> string </Build>
  <CorrelationID> string </CorrelationID>
  <Errors>
    <ErrorClassification> ErrorClassificationCodeType </ErrorClassification>
    <ErrorCode> token </ErrorCode>
    <ErrorParameters ParamID="string">
      <Value> string </Value>
    </ErrorParameters>
    <LongMessage> string </LongMessage>
    <SeverityCode> SeverityCodeType </SeverityCode>
    <ShortMessage> string </ShortMessage>
  </Errors>
  <HardExpirationWarning> string </HardExpirationWarning>
  <Timestamp> dateTime </Timestamp>
  <Version> string </Version>
  <!-- Call-specific Output Fields -->
  <CountryDetails>
    <Country> CountryCodeType </Country>
    <Description> string </Description>
  </CountryDetails>
  <CurrencyDetails>
    <Currency> CurrencyCodeType </Currency>
    <Description> string </Description>
  </CurrencyDetails>
  <DispatchTimeMaxDetails>
    <Description> string </Description>
    <DispatchTimeMax> int </DispatchTimeMax>
  </DispatchTimeMaxDetails>
  <PaymentOptionDetails>
    <Description> string </Description>
    <PaymentOption> BuyerPaymentMethodCodeType </PaymentOption>
  </PaymentOptionDetails>
  <RegionDetails>
    <Description> string </Description>
    <RegionID> string </RegionID>
  </RegionDetails>
  <ShippingLocationDetails>
    <Description> string </Description>
    <ShippingLocation> string </ShippingLocation>
  </ShippingLocationDetails>
  <ShippingServiceDetails>
    <Description> string </Description>
    <ExpeditedService> boolean </ExpeditedService>
    <InternationalService> boolean </InternationalService>
    <ShippingService> token </ShippingService>
    <ShippingServiceID> int </ShippingServiceID>
    <ShippingTimeMax> int </ShippingTimeMax>
    <ShippingTimeMin> int </ShippingTimeMin>
  </ShippingServiceDetails>
  <SiteDetails>
    <Site> SiteCodeType </Site>
    <SiteID> int </SiteID>
  </SiteDetails>
  <TaxJurisdiction>
    <JurisdictionID> string </JurisdictionID>
    <JurisdictionName> string </JurisdictionName>
  </TaxJurisdiction>
  <URLDetails>
    <URL> anyURI </URL>
    <URLType> URLTypeCodeType </URLType>
  </URLDetails>
</GeteBayDetailsResponse>