" . $name . "\n\"\""; foreach($myList as $item){ $itemID = $item->get_elements_by_tagname('ItemID'); $title = $item->get_elements_by_tagname('Title'); $price = $item->get_elements_by_tagname('CurrentPrice'); //return empty array if no thumbnail was provided if(!$thumb = $item->get_elements_by_tagname('GalleryURL')){ $thumb = array(); } $link = "http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=" . $itemID[0]->get_content(); print ""; print ""; if(!empty($thumb)) echo "get_content() . "\" alt=\"\" />"; else echo " "; print "" . $title[0]->get_content() . ""; print "\n"; } print "\n"; } //This is the main function to call from your web page, printMyEbay //takes no arguments and prints any items that you are watchings, bidding on, //and items you've won /* Make sure you replace the first four variables with your own credentials */ function printMyEbay(){ //these keys can be obtained by registering at http://developer.ebay.com $devID = 'your_devID'; $appID = 'your_appID'; $certID = 'your_certID'; //the token representing the eBay user to assign the call with $userToken = 'your_userToken'; //set the Server to use (Sandbox or Production) $serverUrl = 'https://api.ebay.com/ws/api.dll'; //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 = 'GetMyeBayBuying'; //Regulates versioning of the XML interface for the API $compatabilityLevel = 433; //get an array of strings containing the required headers $headers = buildEbayHeaders($devID, $appID, $certID, $compatabilityLevel, $siteID, $verb); ///Build the request Xml string $requestXmlBody = ''; $requestXmlBody .= ''; $requestXmlBody .= "ReturnAll"; $requestXmlBody .= "$userToken"; $requestXmlBody .= ''; $responseXml = sendHttpRequest($requestXmlBody, $serverUrl, $headers); if(stristr($responseXml, 'HTTP 404') || $responseXml == '') die('

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 '

eBay returned the following error(s):'; //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 '

', $code[0]->get_content(), ' : ', str_replace(">", ">", str_replace("<", "<", $shortMsg[0]->get_content())); //if there is a long message (ie ErrorLevel=1), display it if(count($longMsg) > 0) echo '
', str_replace(">", ">", str_replace("<", "<", $longMsg[0]->get_content())); } else { $watchList = $responseDoc->get_elements_by_tagname('WatchList'); if(count($watchList)>0){ $watchItems = $watchList[0]->get_elements_by_tagname('Item'); printItems($watchItems, "Items I'm Watching"); } $bidList = $responseDoc->get_elements_by_tagname('BidList'); if(count($bidList)>0){ $bidItems = $bidList[0]->get_elements_by_tagname('Item'); printItems($bidItems, "Items I'm Bidding On"); } $wonList = $responseDoc->get_elements_by_tagname('WonList'); if(count($wonList)>0){ $wonItems = $wonList[0]->get_elements_by_tagname('Item'); printItems($wonItems, "Items I Won"); } } } ?>