[英]How can I check if a user is currently logged in and playing a facebook app game
[英]How can I get the currently playing song from the audioscrobbler api?
我正在使用zend框架从audioscrobbler api获取信息。 响应格式如下:
<recenttracks user="RJ">
<track nowplaying="true">
<artist mbid="2f9ecbed-27be-40e6-abca-6de49d50299e">Aretha Franklin</artist>
<name>Sisters Are Doing It For Themselves</name>
<mbid/>
<album mbid=""/>
<url>www.last.fm/music/Aretha+Franklin/_/Sisters+Are+Doing+It+For+Themselves</url>
<date uts="1213031819">9 Jun 2008, 17:16</date>
<streamable>1</streamable>
</track>
...
</recenttracks>
我正在访问这样的元素:
$track->name
如何获得即时播放的价值?
您可以尝试以下方法:
$track['nowplaying']
要么:
$track->getAttrib('nowplaying')
要么:
$attributes = $track->attributes();
echo $attributes['nowplaying']
我在任何地方的文档中都看不到它。
根据Zend Framework API文档,您将获得一个SimpleXML对象。 您可以使用它的attribute()方法读取SimpleXMLElement
的属性 :
$track->attributes()->nowplaying
对这个主题不是很了解(Audioscrobbler协议除外),对其进行谷歌搜索似乎表明$track->getAttribute("nowplaying")
应该可以解决问题。 HTH。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.