开发者

PHP -- SimpleXMLElement -- parsing im:image

开发者 https://www.devze.com 2023-04-13 08:57 出处:网络
How do I extract im:image elements.For instance, I can do this: $feed=file_get_contents($url); $xml = new SimpleXMLElement($feed);

How do I extract im:image elements. For instance, I can do this:

$feed=file_get_contents($url);
$xml = new SimpleXMLElement($feed);
$title = $xml->entry[0]->title;
$html = $xml->entry[0]->content;

But I can't get thi开发者_高级运维s:

$img = $xml->entry[0]->im;

How do I target those? I'm willing to use DOMDocument() as well.

EDIT:

<entry>
  <im:image height="55">
    http://foo.com/foo.jpg
  </im:image>
</entry>


The im is just a namespace. You want 'image' element, not im – Dmitri Snytkine 20 hours ago

Yes, that's true, and the clue I needed.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号