Ciao a tutti,
ho una funzione php per recuperare immagini da flickr che utilizza la funzione simplexml_load_file.
Ho cambiato hosting e lo script non funziona più perchè è disattivato allow_url_fopen (mi hanno consigliato di usare cURL).
Avete qualche idea su come modificare il codice per poter recuperare diversamente l'xml?
codice:
<?php
function get_flickr_images( $id, $type = '0',$first, $after, $width, $height ) {
//check if is set the id
if(!isset($id)) return null;
//check if width & height are sets
if(!isset($width) || !isset($height) )
$dim = '';
else
$dim = " width='".$width."' height='".$height."' ";
//check if the script gets the album or a set
($type > 0) ?
$url = "http://api.flickr.com/services/feeds/photoset.gne?set=".$type."&nsid=".$id."&lang=it-it&format=atom" :
$url = "http://api.flickr.com/services/feeds/photos_public.gne?id=".$id."&lang=it-it&format=atom";
//connect to the atom feed
$xml = simplexml_load_file($url) or die ("Unable to load XML file");
//get the url and the image and save them into an array
$flickr = Array();
foreach( $xml->entry as $row ) {
array_push( $flickr, $first . "[img]" . $row->link[1][[/img]" . $after . "\n" );
}
//return the array
return $flickr;
}
?>