phpFlickr authentication to access private photos

1:https://github.com/jrtilson/phpflickr/tree/master/token

download index.php & auth.php

or

my demo

2:edit index.php
   2-1 mark:

        //$f->auth($_SESSION[‘perms’]);  //會造成迴圈
        //$token = $f->auth_checkToken($_SESSION[‘phpFlickr_auth_token’]);  //無用

   !!important!! token usually is ok~ and phpFlickr check token is broken.
This can check token   https://www.flickr.com/services/api/explore/flickr.auth.checkToken 

   2-2 change:

 echo “” . $_SESSION[‘phpFlickr_auth_token’][_content] . “";
 //要補上[_content]

3:call back URL set THIS FILE:**http://xxxxoooo.com/**auth.php

   IF not sure, just index.php when you not login. index.php have Set the callback url to: xxxxxxoooooo

4:How to access private photos
 
    require_once(“phpFlickr.php”);
 
    $token = “"; //put now get token
    $api_key =""; //put api
    $secret =""; //put secret
 
    $f = new phpFlickr($api_key, $secret);
    $f->setToken($token);

    !!important!! Don’t $f.auth() again~ DO NOT DO AGAIN.

    method 1:
      $res = $f->photosets_getList(); //get all Albums
      $PhotosetList = $res[‘photoset’];
      //print_r($PhotosetList);   //just test

    method 2:
    $Allphoto = $f->photosets_getPhotos(‘xxxxxxxxxx’);  //xxxx -> put Albums ID

    if (is_array($Allphoto)){
      foreach ($Allphoto as $AllphotoList){
        foreach ($AllphotoList[‘photo’] as $PhotoInfo){
          $imgsrc = $f->buildPhotoURL($PhotoInfo, “small”);
         
          echo “";
    }
      }
    }