Skip to content


Installation Instructions

  1. You have to be sure that you have the php PEAR prereq packages installed. The only one you absolutely need is HTTP_Request. If you want to do any caching, you'll also need to install the DB package.

    NOTE: If you have installed version 1.3.1 of phpFlickr or later with the prereqs included, you can skip this step.

    If you have PEAR installed on your *nix server, you can run "pear install [package]" from the command line. You can find much more information and documentation at http://pear.php.net/. You can get detailed installation instructions there.

  2. Copy the files contained in the archive into the same folder on your server. They need to be readible by your web server. You can put them into an include folder defined in your php.ini file, if you like, though it's not required.
  3. All you have to do now is include the phpFlickr.php file in your PHP scripts and create an instance. For example:
    $f = new phpFlickr();

    The constructor has three arguments:

    1. $api_key – This is the API key given to you by flickr.com. This argument is required and you can get an API Key at: http://www.flickr.com/services/api/key.gne
    2. $secret – The "secret" is optional because is not required to make unauthenticated calls, but is absolutely required for the new authentication API (see Authentication section below). You will get one assigned alongside your api key.
    3. $die_on_error – This takes a boolean value and determines
      whether the class will die (aka cease operation) if the API
      returns an error statement. It defaults to false. Every method
      will return false if the API returns an error. You can access
      error messages using the getErrorCode() and getErrorMsg()
      methods.
  4. All of the API methods have been implemented in my class. You can see a full list and documentation here: http://www.flickr.com/services/api/. To call a method, remove the "flickr." part of the name and replace any periods with underscores. For example, instead of flickr.photos.search, you would call $f->photos_search() or instead of flickr.photos.licenses.getInfo, you would call $f->photos_licenses_getInfo() (yes, it is case sensitive). All functions have their arguments implemented in the list order on their documentation page (a link to which is included with each function in the clasS). The only exception to this is photos_search() which has so many optional arguments that it's easier for everyone around if you just have to pass an associative array of arguments. See the comment in the photos_search() definition in phpFlickr.php for more information.

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.