I’m getting an rss feed from flickr, and using SimpleXMLElement, however it seems to not pick up on attributes?
$feedurl = "http://api.flickr.com/services/feeds/photos_public.gne?id=48839201@N07&lang=en-us&format=rss_200";
$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,$feedurl);
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
$feed = curl_exec($curl_handle);
curl_close($curl_handle);
$curl = curl_init($feedurl);
curl_setopt_array(
$curl,
array(
CURLOPT_CONNECTTIMEOUT => 5,
CURLOPT_RETURNTRANSFER => true
)
);
if(false !== ($data = curl_exec($curl))){
try{
$xmlData = new SimpleXMLElement($data);
}catch(Exception $exception){
$xmlData = false;
}
}
if($xmlData != false) {
print_r($xmlData);
} else {
echo "Error";
}
It doesn’t seem to get “<media:thumbnail>” or “<media:category>” and all that… any idea why?
It only picks:
[0] => SimpleXMLElement Object
(
[title] =>
[link] =>
[description] =>
[pubDate] =>
[author] =>
[guid] =>
)
*obviously filled in, I just removed all the content