I'm using finding service has URL and it works fine, $url = '
http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsAdvanced'; $url .= '&SERVICE-NAME=FindingService&SERVICE-VERSION=1.0.0&GLOBAL-ID=EBAY-GB'; $url .= '&SECURITY-APPNAME=' . $appid . '&RESPONSE-DATA-FORMAT=XML'; $url .='&keywords=' . $itemnumber; I now need to call GetSingleItem $url2 = '
http://open.api.ebay.com/shopping?callname=GetSingleItem&responseencoding=XML&appid=' . $appid . '&siteid=0&version=967&ItemID=' . $itemnumber . "&IncludeSelector=Description,ItemSpecifics"; Both return success using $resp2 = file_get_contents($url2); but when i use $xml2 = new SimpleXMLElement($resp2); it returns a non object, how can i call the elements from resp2 for its details similar too $itemid = (string) $xml->searchResult->item->itemId; $shipcost = (string) $xml->searchResult->item->shippingInfo->shippingServiceCost;
Extracting data from XML works the same way in every XML API, but the nodes vary. Save the XML response to a file and load it into a hierarchical viewer like Firefox. Or read the docs, which include a hierachical display. $qty = (string) $xml2->searchResult->item->Quantity; <--- $xml2 2018-01-04T23:54:39.220Z Success E1033_CORE_APILW_18542200_R1 1033 <--- $xml2->Item 1 <--- $xml2->Item->Quantity 0 If you still can't figure it out, find a PHP tutorial.
I cant for the life of me work this API out, i have just var_dump the findItemsAdvanced and it looks identical, i would be glad to move to GetSingleItem but i cant seem to get info off the documentation. I have look at searchResult for findingApi, i found information right away on that but item listing details for GetSingleItem.. no, goin to look again
I've looked at docs, cant see wood for trees this is how a call findItemsAdvanced so if i need to change to getsingleitems i'm not sure of the tree structure it outputs $qty = (string) $xml2->searchResult->item->Quantity;
Since the Shopping API returns different data, it has a different format and doesn't return a searchResult node. Look at the docs or the XML response itself to determine where the data you need is located. Also, FWIW, if you already have the item number the call to findItemsAdvanced may not be necessary. GetSingleItem/GetMultiplItem return a lot of the same data. Depends on your needs.
I have got rid of the errors, only thing now is how do i extract the quantity of that item? is it from xml2? when i use this method same as $url findItemsAdvanced i get a non object error $qty = (string) $xml2->searchResult->item->Quantity;