This API will construct the appropriate Flickr REST API URL to query, and use RequestCore and json_decode() to retrieve and parse the JSON data (by default).
The extended FlickrCache response differs from the default Flickr class response. To get the actual response data, you don't have to use $response->body
, you can simply use $response
. Simple file based caching support has also been added, but is disabled by default. You can enable it by using the cache_mode()
method.
- PHP 5.2
- cURL
- JSON Functions
- SimpleXML
- RequestCore
git clone [email protected]:jaywilliams/flickr.git
cd flickr
git submodule init
git submodule update
You can rename config-sample.inc.php
to config.inc.php
and add your key/secret there, or you can pass your key/secret key to the constructor.
I would recommend the former over the latter if you generally only use one key/secret set.
If you want to make a request to Flickr's flickr.people.findByUsername
method, you'd do the following. This makes a request using RequestCore, defaults to a JSON response from Flickr, and parses it with json_decode().
$flickr = new FlickrCache();
$flickr->cache_mode(true, 3600, './cache/');
$response = $flickr->people->find_by_username(array(
'username' => 'skyzyx'
));
echo $response->user->id;
var_dump($response);
You can look through the response to see how to traverse through the data.
URL: http://github.com/skyzyx/flickr
Copyright (c) 2009, Ryan Parman MIT license
URL: http://github.com/jaywilliams/flickr
Copyright (c) 2009, Jay Williams MIT license