Hola a todos.
tengo unpequeño problema con XML, la cuestion es q ue obtengo mi xml de una url de la siguiente manera
Código PHP:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,
"http://mipagina.com");
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$resultado = curl_exec ($ch);
y es un xml bien formado por q en el navegador me habre correctamente
lo convierto a objetoXML con la siguiente linea
Código PHP:
$xml = new SimpleXMLElement( $resultado);
cuando quiero recuperar mi nodos y los atributos de cada nodo no puedo hacerlo, cuando hago un
Código PHP:
var_dump($xml);
me muestra algo asi
Código:
object(SimpleXMLElement)#1 (2) {
["@attributes"]=>
array(2) {
["generated_in"]=>
string(6) "0.1481"
["stat"]=>
string(2) "ok"
}
["videos"]=>
object(SimpleXMLElement)#2 (2) {
["@attributes"]=>
array(4) {
["on_this_page"]=>
string(2) "25"
["page"]=>
string(1) "1"
["perpage"]=>
string(2) "25"
["total"]=>
string(4) "1000"
}
["video"]=>
array(25) {
[0]=>
object(SimpleXMLElement)#3 (1) {
["@attributes"]=>
array(7) {
["embed_privacy"]=>
string(8) "anywhere"
["id"]=>
string(7) "4660957"
["is_hd"]=>
string(1) "0"
["owner"]=>
string(6) "846001"
["privacy"]=>
string(7) "anybody"
["title"]=>
string(5) "Vimeo"
["upload_date"]=>
string(19) "2009-05-15 05:08:59"
}
}
ya intente de todo y no puedo acceder ni a los nodos ni a mis variables.
espero me puedan ayudar, gracias
saludos