Obtener atributo de XML con SimpleXML
Estoy tratando de obtener el$xml->entry->yt:statistics->attributes()->viewCount
atributo, y he probado algunas cosas con SimpleXML, ¡y realmente no puedo hacerlo funcionar!
Intento # 1
<?php
$xml = simplexml_load_file("http://gdata.youtube.com/feeds/api/videos?author=Google");
echo $xml->entry[0]->yt:statistics['viewCount'];
?>
Intento # 2
<?php
$xml = simplexml_load_file("http://gdata.youtube.com/feeds/api/videos?author=Google");
echo $xml->entry[0]->yt:statistics->attributes()->viewCount;
?>
Ambos volvieron en blanco, aunque SimpleXML está funcionando, intenté obtener el título del feed, ¡lo cual funcionó!
¿Algunas ideas?
He visto muchos otros ejemplos en SO y otros sitios, pero, de alguna manera, ¿esto no funciona? ¿PHP reconoce que ':' es un corte, o simplemente estoy haciendo algo estúpido?
Gracias, cualquier respuesta muy apreciada!