J'utilise le fichier "simplexml_load_file" de PHP pour obtenir des données de Flickr.Comment extraire l'URL d'une chaîne en PHP?
Mon but est d'obtenir l'url de la photo.
Je suis en mesure d'obtenir la valeur suivante (affectée à la variable PHP):
<p><a href="http://www.flickr.com/people/[email protected]/">codewrecker</a> posted a photo:</p>
<p><a href="http://www.flickr.com/photos/[email protected]/2302759205/" title="Santa Monica Pier"><img src="http://farm3.static.flickr.com/2298/2302759205_4fb109f367_m.jpg" width="180" height="240" alt="Santa Monica Pier" /></a></p>
Comment puis-je extraire juste cette partie?
http://farm3.static.flickr.com/2298/2302759205_4fb109f367_m.jpg
Juste au cas où il aide, voici le code que je travaille avec:
<?php
$xml = simplexml_load_file("http://api.flickr.com/services/feeds/[email protected]&lang=en-us&format=xml&tags=carousel");
foreach($xml->entry as $child) {
$flickr_content = $child->content; // gets html including img url
// how can I get the img url from "$flickr_content"???
}
?>