PHP code example of carlos-mg89 / phpflickr

1. Go to this page and download the library: Download carlos-mg89/phpflickr library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

carlos-mg89 / phpflickr example snippets



$flickr = new \Samwilson\PhpFlickr\PhpFlickr($apiKey, $apiSecret);

   $storage = new \OAuth\Common\Storage\Memory();
   $flickr->setOauthStorage($storage);
   

   $perm = 'read';
   $url = $flickr->getAuthUrl($perm, $callbackUrl);
   

      $accessToken = $flickr->retrieveAccessToken($_GET['oauth_verifier'], $_GET['oauth_token']);
      

      $verifier = '<9-digit code stripped of hyphens and spaces>';
      $accessToken = $flickr->retrieveAccessToken($verifier);
      

// Create storage.
$storage = new \OAuth\Common\Storage\Memory();
// Create the access token from the strings you acquired before.
$token = new \OAuth\OAuth1\Token\StdOAuth1Token();
$token->setAccessToken($accessToken);
$token->setAccessTokenSecret($accessTokenSecret);
// Add the token to the storage.
$storage->storeAccessToken('Flickr', $token);

$flickr->setOauthStorage($storage);
$recent = $phpFlickr->photos_getContactsPhotos();

$flickr->uploader()->upload('/path/to/photo.jpg');

$flickr->uploader()->replace('/path/to/photo.jpg', 44333812150);

$flickr->setProxyBaseUrl('http://localhost:8181/flickr');