YouTube SimpleXMLElement 问题!
我正在用 php for youtube 做一些事情,但是用户图片部分中出现的 xml 文件没有出现在输出中。
代码:
$feedURL = 'http://gdata.youtube.com/feeds/api/users/davidguetta';
$sxml = simplexml_load_file($feedURL);
输出:
SimpleXMLElement Object
(
[id] => http://gdata.youtube.com/feeds/api/users/davidguetta
[published] => 2006-07-26T12:05:23.000-07:00
[updated] => 2011-08-26T04:34:26.000-07:00
[category] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[scheme] => http://schemas.google.com/g/2005#kind
[term] => http://gdata.youtube.com/schemas/2007#userProfile
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[scheme] => http://gdata.youtube.com/schemas/2007/channeltypes.cat
[term] => Musician
)
)
)
[title] => davidguetta Channel
[link] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[rel] => http://gdata.youtube.com/schemas/2007#user.vlog
[type] => application/atom+xml
[href] => http://gdata.youtube.com/feeds/api/playlists/18F8D522B6C5D32C
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[rel] => related
[type] => text/html
[href] => http://www.davidguetta.com
)
)
[2] => SimpleXMLElement Object
(
[@attributes] => Array
(
[rel] => alternate
[type] => text/html
[href] => http://www.youtube.com/profile?user=davidguetta
)
)
[3] => SimpleXMLElement Object
(
[@attributes] => Array
(
[rel] => self
[type] => application/atom+xml
[href] => http://gdata.youtube.com/feeds/api/users/davidguetta
)
)
)
[author] => SimpleXMLElement Object
(
[name] => davidguetta
[uri] => http://gdata.youtube.com/feeds/api/users/davidguetta
)
)
为什么不输出以下内容?
<media:thumbnail url='http://i2.ytimg.com/i/uYZ-sFza5K_3GF0LyQAxjg/1.jpg'/>
i'm doing something with php for youtube but xml file that appear in the user picture section, does not appear in the output.
code:
$feedURL = 'http://gdata.youtube.com/feeds/api/users/davidguetta';
$sxml = simplexml_load_file($feedURL);
output:
SimpleXMLElement Object
(
[id] => http://gdata.youtube.com/feeds/api/users/davidguetta
[published] => 2006-07-26T12:05:23.000-07:00
[updated] => 2011-08-26T04:34:26.000-07:00
[category] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[scheme] => http://schemas.google.com/g/2005#kind
[term] => http://gdata.youtube.com/schemas/2007#userProfile
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[scheme] => http://gdata.youtube.com/schemas/2007/channeltypes.cat
[term] => Musician
)
)
)
[title] => davidguetta Channel
[link] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[rel] => http://gdata.youtube.com/schemas/2007#user.vlog
[type] => application/atom+xml
[href] => http://gdata.youtube.com/feeds/api/playlists/18F8D522B6C5D32C
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[rel] => related
[type] => text/html
[href] => http://www.davidguetta.com
)
)
[2] => SimpleXMLElement Object
(
[@attributes] => Array
(
[rel] => alternate
[type] => text/html
[href] => http://www.youtube.com/profile?user=davidguetta
)
)
[3] => SimpleXMLElement Object
(
[@attributes] => Array
(
[rel] => self
[type] => application/atom+xml
[href] => http://gdata.youtube.com/feeds/api/users/davidguetta
)
)
)
[author] => SimpleXMLElement Object
(
[name] => davidguetta
[uri] => http://gdata.youtube.com/feeds/api/users/davidguetta
)
)
why does not the output of the following?
<media:thumbnail url='http://i2.ytimg.com/i/uYZ-sFza5K_3GF0LyQAxjg/1.jpg'/>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来 SimpleXMLElement 被标签名称中的“:”混淆了。您可能应该改用 YouTube PHP 数据 API。
It looks like the SimpleXMLElement is getting confused by ':' in tag names. You should probably be using the YouTube PHP Data API instead.