Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2014
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.15 KB | None | 0 0
  1. // Este es el objeto devuelto que quiero parsear:
  2. Array
  3. (
  4.     [0] => SimpleXMLElement Object
  5.         (
  6.             [Datos] => SimpleXMLElement Object
  7.                 (
  8.                     [@attributes] => Array
  9.                         (
  10.                             [Idioma] => 1
  11.                             [Codigo] => PQ26CK0700035770129009Y
  12.                             [Evento] => 1
  13.                             [web_id] => Sin web_id
  14.                         )
  15.  
  16.                     [Estado] => En tránsito.
  17.                     [Fecha] => 23/07/2014
  18.                 )
  19.  
  20.         )
  21.  
  22. )
  23.  
  24. // Lo parseo así:
  25.  
  26. $ret['localizador'] = $localizador;
  27. $ret['estado'] = $res[0]->Datos->attributes();
  28. $ret['fecha'] = $res[0]->Datos->Fecha;
  29.  
  30. // Pero el array resultanto tiene la siguiente estructura:
  31.  
  32. Array
  33. (
  34.     [localizador] => PQ26CK0700035770129009Y
  35.     [estado] => SimpleXMLElement Object
  36.         (
  37.             [0] => En tránsito.
  38.         )
  39.  
  40.     [fecha] => SimpleXMLElement Object
  41.         (
  42.             [0] => 23/07/2014
  43.         )
  44.  
  45. )
  46.  
  47. // Como cojones me quito el SimpleXMLElement Object ( [0] => .... ) y saco solo el string de la fecha?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement