/',$nsid_xml,$found)) return $found[1][0]; else return false; } // Look up an NSID given an email function findByEmail($email) { global $api_key; $nsid_xml = file_get_contents('http://www.flickr.com/services/rest/?method=flickr.people.findByEmail&api_key='.$api_key.'&find_email='.$email); if(preg_match_all('/username>([^<]+)<\/username>/',$nsid_xml,$found)) return findByUsername($found[1][0]); else return false; } // Get info for a given photo ID function getInfo($photo_id,$secret) { global $api_key; $info_xml = file_get_contents('http://www.flickr.com/services/rest/?method=flickr.photos.getInfo&api_key='.$api_key.'&photo_id='.$photo_id.'&secret='.$secret); preg_match_all('/description>([^<]+)<\/description>/',$info_xml,$description_array); $info['description'] = mysql_real_escape_string(html_entity_decode($description_array[1][0])); preg_match_all('/ispublic="(\d)"/',$info_xml,$ispublic_array); $info['ispublic'] = $ispublic_array[1][0]; preg_match_all('/lastupdate="(\d+)"/',$info_xml,$posted_array); $info['posted'] = date('Y-m-d H:i:s',$posted_array[1][0]); preg_match_all('/taken="([^"]+)"/',$info_xml,$taken_array); $info['taken'] = $taken_array[1][0]; preg_match_all('/comments>(\d+)<\/comments>/',$info_xml,$comments_array); $info['comments'] = mysql_real_escape_string(html_entity_decode($comments_array[1][0])); preg_match_all('/photopage">([^<]+)<\/url>/',$info_xml,$photopage_array); $info['photopage'] = $photopage_array[1][0]; preg_match_all('/">(\w+)<\/tag>/',$info_xml,$tags_array); $info['tags'] = mysql_real_escape_string(html_entity_decode(implode($tags_array[1],' '))); return $info; } ?>