Answer the question
In order to leave comments, you need to log in
How to extract values from XML?
Hello!
There is this repeating XML structure:
<entry>
<author>
<name>Dunnock_D</name>
<uri>http://www.flickr.com/people/dunnock_d/</uri>
</author>
<link rel="license" type="text/html" href="https://creativecommons.org/licenses/by-nc/2.0/deed.en" />
<link rel="enclosure" type="image/jpeg" href="http://farm8.staticflickr.com/7548/26820724620_1d221c3187_b.jpg" />
</entry>
$xml = simplexml_load_string($result);
foreach ($xml->entry as $pixinfo) {
echo $pixinfo->link[1]['href'];
}
Answer the question
In order to leave comments, you need to log in
I'm not really into php, but I think something like this:$xml->xpath("//link[@rel='enclosure']");
at least you can use preg_match_all
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question