Ver Mensaje Individual
  #8 (permalink)  
Antiguo 23/05/2012, 14:01
Avatar de Heiroon
Heiroon
 
Fecha de Ingreso: junio-2010
Ubicación: Caracas, Venezuela - Por ahora...
Mensajes: 495
Antigüedad: 13 años, 10 meses
Puntos: 63
Exclamación Respuesta: ¿Cómo leer XML directamente con PHP?

Bueno, creo que eso del GML no tiene nada que ver... Sin embargo estoy haciendo lo siguiente y me devuelve un objeto vacio...

Código PHP:
Ver original
  1. header("Content-type: text/html; charset=utf-8");
  2.     //header('Content-type: text/xml');
  3.    
  4.     //Definición de los parámetros a enviar en la petición.
  5.    
  6.     $service  = "SERVICE=WFS";
  7.     $request  = "REQUEST=GetFeature";
  8.     $output   = "OUTPURFORMAT=text/xml;subtipo=gml/3.1.1";
  9.     $typename = "TYPENAME=C1C_Mobile_c1c_mobile:Eventos";
  10.    
  11.     $params = "?$service&$request&$output&$typename";
  12.    
  13.     try
  14.     {
  15.         $wfsReq = WFS_REQ_PATH.$params;
  16.         $response = file_get_contents($wfsReq);
  17.        
  18.         $xml = new SimpleXMLElement($response);
  19.         var_dump($xml);
  20.        
  21.     }
  22.     catch (Exception $e)
  23.     {
  24.         echo "Something went wrong: ".$e;
  25.     }

y me devuelve:

object(SimpleXMLElement)#1 (0) { }
__________________
Gmail : [email protected]
Twitter: @heiroon

I'm back!