// Start the session since phpFlickr uses it but does not start it itself
session_start();
// Require the phpFlickr API
require_once('phpFlickr-3.1/phpFlickr.php');
// Create new phpFlickr object: new phpFlickr('[API Key]','[API Secret]')
$flickr = new phpFlickr('[API KEY]','[API SECRET]', true);
// Authenticate; need the "IF" statement or an infinite redirect will occur
if(empty($_GET['frob'])) {
$flickr->auth('write'); // redirects if none; write access to upload a photo
}
else {
// Get the FROB token, refresh the page; without a refresh, there will be "Invalid FROB" error
$flickr->auth_getToken($_GET['frob']);
header('Location: flickr.php');
exit();
}
Source : http://davidwalsh.name/flickr-php
Leave a Reply