Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/08/2009, 16:17
Suyta
(Desactivado)
 
Fecha de Ingreso: septiembre-2004
Mensajes: 360
Antigüedad: 19 años, 7 meses
Puntos: 1
simplexml_load_file()

Hola

Trato de parser from Ebay:

Código PHP:
$url="http://svcs.ebay.com/MerchandisingService?OPERATION-NAME=getMostWatchedItems&SERVICE-NAME=MerchandisingService&SERVICE-VERSION=1.1.0&CONSUMER-ID=YOUR_API_ID&RESPONSE-DATA-FORMAT=XML&categoryId=397";

$resp simplexml_load_file($url);

print_r($resp); 
Hast ahí todo bien, me devuelve este array:
Código PHP:
SimpleXMLElement Object
(
    [
ack] => Success
    
[version] => 1.1.0
    
[timestamp] => 2009-08-27T21:59:56.080Z
    
[itemRecommendations] => SimpleXMLElement Object
        
(
            [
item] => Array
                (
                    [
0] => SimpleXMLElement Object
                        
(
                            [
itemId] => 280388078141
                            
[title] => Vintage Atmos 2 LeCoultre Jaeger Mantel Clock 
                            
[viewItemURL] => http://cgi.ebay.com/Vintage-Atmos-2-LeCoultre-Jaeger-Mantel-Clock_W0QQitemZ280388078141QQcategoryZ13858QQcmdZViewItemQQ_trksidZm8QQ_trkparmsZalgo%3DMW%26its%3DC%26itu%3DUCC%26otn%3D8%26ps%3D50
                            
[currentPrice] => 500.0
                            
[globalId] => EBAY-US
                            
[timeLeft] => P4DT2H8M48S
                            
[subtitle] => EARLY CLOCK WITH LOW REGISTRATION NUMBER 1940s
                            
[country] => US
                            
[imageURL] => http://thumbs.ebaystatic.com/pict/280388078141_1.jpg
                            
[shippingType] => Freight
                        

Pero no logro acceder a cada elemento del array: itemid, title, etc.
Alguien tiene un minuto para decirme cómo.
Intento por ejemplo:

Código PHP:
$item $resp->item;   
$itemId $item->itemId;   
print 
$itemId
Pero nada... página en blanco