<?php
$feed = file_get_contents('http://thexmofo.wordpress.com/feed/');
$xml = new SimpleXMLElement($feed);
$xml->registerXPathNamespace('media', 'http://thexmofo.wordpress.com/feed/');
$images = $xml->xpath('/rss/channel/item/media:content@url');
var_dump($images);
?>
Can anyone tell my why I'm getting Warning: SimpleXMLElement::xpath() [simplexmlelement.xpath]: Invalid expression
followed by bool(false)
?
That XPath expression is invalid, that much we know. Now since you didn't say what you were trying to select, all we can do is randomly guess your intentions, so here's my random guess:
/rss/channel/item/media:content/@url
...assuming you're trying to select all the @url attributes in that feed.
Well, bool(false)
is probably from your var_dump
.
Iam not sure if media:content@url
is valid xpath...