Category Archives: php

Let’s say we want to create a test script testflickr.php, which will get access to user’s Flickr account and show some information.

  1. Get a Flickr API key and secret (http://www.flickr.com/services/apps/).
  2. Set the callback URL for the new app (click your app name and then “edit” in the right menu). This can be the test file you are creating, so http://…/testflickr.php.
  3. testflickr.php can look like:


<?php
require_once("phpFlickr/phpFlickr.php");
$api_key = your Flickr app key;
$api_secret = your Flickr app secret;
$f = new phpFlickr($api_key, $api_secret);
if (empty($_GET['frob'])) {
$f->auth("read", false);
} else {
$f->auth_getToken($_GET['frob']);
}
$token = $f->auth_checkToken();
$nsid = $token['user']['nsid'];
// Get the friendly URL of the user's photos
$photos_url = $f->urls_getUserPhotos($nsid);