Ciao a tutti ragazzi!
Ho un piccolo problema nel salvare un file xml in php.
Ho il seguente codice:
$query = 'iphone';
$SafeQuery = urlencode($query);
$endpoint = 'http://open.api.ebay.com/shopping';
$responseEncoding = 'XML';
$apicall = "$endpoint?callname=FindItems&version=517&appid=XX XXXX-XXXXX-XXXX&QueryKeywords=$SafeQuery&responseencoding=$re sponseEncoding";
$resp = simplexml_load_file($apicall);
In pratica sto usando le API di eBay. Lo script funziona alla grande ora però il file che estraggo tramite query se lo visualizzo con var_dump($resp) mi viene restituito nel formato di un oggetto simple_xml
object(SimpleXMLElement)#1 (7) { ["Timestamp"]=> string(24) "2008-11-16T09:53:56.726Z" ["Ack"]=> string(7) "Success" ["Build"]=> string(28) "e589_core_Bundled_7495152_R1" ["Version"]=> string(3) "589" ["Item"]=> array(3) { [0]=> object(SimpleXMLElement)#2 (14) { ["ItemID"]=> string(12) "220308538912" ["BuyItNowAvailable"]=> string(4) "true" ["ConvertedBuyItNowPrice"]=> string(5) "18.55" ["EndTime"]=> string(24) "2008-11-16T09:54:00.000Z" ["ViewItemURLForNaturalSearch"]=> string(126) "http://cgi.ebay.com/GOLD-METAL-BACK-HOUSING-COVER-FOR-AU-APPLE-iPHONE-LENS_W0QQitemZ220308538912QQcategoryZ14418QQcmdZVi ewItem" ["ListingType"]=> string(7) "Chinese" ["PrimaryCategoryID"]=> string(5) "14418" ["PrimaryCategoryName"]=> string(45) "Phones:Mobile Accessories:Covers:Other Covers" ["BidCount"]=> string(1) "0" ["ConvertedCurrentPrice"]=> string(5) "16.56" ["ListingStatus"]=> string(6) "Active" ["TimeLeft"]=> string(4) "PT4S" ["Title"]=> string(55) "GOLD METAL BACK HOUSING COVER FOR AU APPLE iPHONE +LENS" ["ShippingCostSummary"]=> object(SimpleXMLElement)#5 (2) { ["ShippingServiceCost"]=> string(5) "11.26" ["ShippingType"]=> string(4) "Flat" } } [1]=> object(SimpleXMLElement)#3 (12) { ["ItemID"]=> string(12) "110311877113" ["EndTime"]=> string(24) "2008-11-16T09:54:01.000Z" ["ViewItemURLForNaturalSearch"]=> string(127) "http://cgi.ebay.com/Car-FM-Transmitter-Charger-REMOTE-for-iPhone-iPod-Touch_W0QQitemZ110311877113QQcategoryZ86541QQcmdZV iewItem" ["ListingType"]=> string(14) "FixedPriceItem" ["GalleryURL"]=> string(57) "http://thumbs2.ebaystatic.com/pict/1103118771138080_1.jpg" ["PrimaryCategoryID"]=> string(5) "86541" ["PrimaryCategoryName"]=> string(54) "Electronics:MP3, Digital Accessories:Other Accessories" ["ConvertedCurrentPrice"]=> string(5) "11.26" ["ListingStatus"]=> string(6) "Active" ["TimeLeft"]=> string(4) "PT5S" ["Title"]=> string(55) "Car FM Transmitter/Charger/REMOTE for iPhone/iPod Touch" ["ShippingCostSummary"]=> object(SimpleXMLElement)#6 (2) { ["ShippingServiceCost"]=> string(4) "7.28" ["ShippingType"]=> string(4) "Flat" } } [2]=> object(SimpleXMLElement)#4 (13) { ["ItemID"]=> string(12) "130268821456" ["EndTime"]=> string(24) "2008-11-16T09:55:13.000Z" ["ViewItemURLForNaturalSearch"]=> string(127) "http://cgi.ebay.com/unlock-3G-iPhone-turbosim-turbo-sim-card-no-cut-2-1-new_W0QQitemZ130268821456QQcategoryZ29778QQcmdZVie wItem" ["ListingType"]=> string(7) "Chinese" ["GalleryURL"]=> string(57) "http://thumbs2.ebaystatic.com/pict/1302688214568080_1.jpg" ["PrimaryCategoryID"]=> string(5) "29778" ["PrimaryCategoryName"]=> string(46) "Cell Phones & PDAs:Phone & SIM Cards:SIM Cards" ["BidCount"]=> string(1) "0" ["ConvertedCurrentPrice"]=> string(4) "0.99" ["ListingStatus"]=> string(6) "Active" ["TimeLeft"]=> string(7) "PT1M17S" ["Title"]=> string(55) "unlock 3G iPhone turbosim turbo sim card no cut 2.1 new" ["ShippingCostSummary"]=> object(SimpleXMLElement)#7 (2) { ["ShippingServiceCost"]=> string(4) "9.99" ["ShippingType"]=> string(4) "Flat" } } } ["TotalItems"]=> string(5) "67785" ["ItemSearchURL"]=> string(72) "http://search.ebay.com/ws/search/SaleSearch?fsoo=1&fsop=1&satitle=iphone" }
e io lo vorrei salvare come XML puro. Mi sapreste aiutare? Vi ringrazio
Buona domenica a tutti