Php 如何从xml中获取这些信息?

Php 如何从xml中获取这些信息?,php,xml,Php,Xml,如何从该xml中获取链接href(位于已发布节点下): <entry> <id>tag:search.twitter.com,2005:8927670fcdf59031552</id> <published>2011-07-08T10:16:40Z</published> <link type="text/html" href="http://twitter.com/username/statuses/892767c088fds0

如何从该xml中获取链接href(位于已发布节点下):

<entry>
<id>tag:search.twitter.com,2005:8927670fcdf59031552</id>
<published>2011-07-08T10:16:40Z</published>
<link type="text/html" href="http://twitter.com/username/statuses/892767c088fds031552" rel="alternate"/>
<title>dfdf</title>
<content type="html">fdf</content>
<updated>2011-07-08T10:16:40Z</updated>
<link type="image/png" href="http://a0.twimg.com/profile_images/14014071/RV_normal.JPG" rel="image"/>
<twitter:geo>
</twitter:geo>
<twitter:metadata>
  <twitter:result_type>recent</twitter:result_type>
</twitter:metadata>
<twitter:source>&lt;a href=&quot;http://www.tweetdeck.com&quot; rel=&quot;nofollow&quot;&gt;TweetDeck&lt;/a&gt;</twitter:source>
<twitter:lang>en</twitter:lang>
<author>
  <name></name>
  <uri></uri>
</author>
我看到的问题是有多个链接节点,而且链接节点也有多个属性。

请尝试:

$url = $xml->entry->link[0]->href;
试试这个:

$xml->entry->link[0]->attributes()->href; //this is for the first href node
$xml->entry->link[0]->attributes()->href; //this is for the first href node