Accessing Flickr & with PHP

Recently, we at Outside Line launched a new website for Golden Wonder’s new noodle brand, The Nations Best. In a departure from the normal day-to-day, I built the bespoke server-side functionality to power the nifty Flash front-end. In doing so, I put together a few PHP libraries, one to access the Flickr API and one to access the Host IP geolocation service API.

  $images = $this->flickr->get('', array(
    'per_page' => '50',
    ’sort' => 'relevance',
    'text' => 'Exmouth Market',

Both classes, being built at the same time, have a similar structure and similar functionality. They both feature a cache mechanism to limit your requests and enhance performance, and the both are pretty open ended in what they allow you to do. The Flickr class allows access to any method that doesn’t require authentication, and returns the results as a PHP array, (in the same format as the original Flickr response).

  $latlong = $this->hostip->getLatLong('');
  $location = $this->hostip->getLocation'');

The Host IP class is slightly more limited, but is easy to extend if more information is required. The results are obtained form a parsed XML response, and contain information outside of the latitude, longitude, city and country. Because of the way in which SimpleXML handles the name spaces, there is also bit of hacking in place to parse the XML.

You can download the Flickr and Host IP classes from my GitHub account, and they are both offered freely but with no support or guarantee.