Search

Has somebody experience with integrating a private flickr gallery?

I was able to get the authentication, frob and token done. But I have problems to put the right url for my dynamic data source together to receive a answer in xmlrpc for a gallery call.

Another problem is that, as far as I understand the api, every call needs its custum signature (md5) added.

I think the best approach might be to create the dynamic datasource, then go into the datasource php file and customize it to handle the md5, etc.

I got the links working manually and am now asking for a helping hand to edit the datasource php.

What I’ve done so far:

  • section flickrset for photoset id input
  • datasource flickrset with photoset id parameter output
  • dynamic datasource flickr-xml with url

    http://api.flickr.com/services/rest/?method=flickr.photosets.getPhotos&photosetid={$ds-flickrset}&format=xmlrpc&apikey=MYKEY&authtoken=MYTOKEN&apisig=$signature

The {$ds-flickrset} gets replaced with the photoset_id, fine. Now I need to edit the datasource php to replace $signature with something like this:

sig = "_MY_SECRET_" + "api_key" + "_MY_KEY_" + "auth_token" + "_MY_TOKEN_" + "format" + "xmlrpc" + "method" + "flickr.photosets.getPhotos" + "photoset_id" + {$ds-flickrgetset};
signature = MD5(sig);

This is where I got stuck…

Figured it out… thanks anyway… really start loving symphony

Glad to hear it worked out. If you’ve got it handy, it would be great to have your full solution posted up here, I’m sure others will find it useful (including myself).

hm, went back to manually adding the corresponding signature hash

  • section flickrset for photoset id input and signature md5 hash input
  • datasource flickrset with photoset id parameter output
  • datasource flickrsig with signature parameter output
  • dynamic datasource flickr-xml with url

Wasn’t able to find a way to provide the hashed signature as parameter for the url by just editing the datasource php. …cheered too soon. sorry!

Started reading this as I am looking for exactly the same thing but with api.paymo.biz, did you find a dynamic solution at all?

Currently I am still entering the needed hash manually to each gallery entry

I ran into exactly the same problem these days and found a solution that seems to work pretty good for me.

But as my Experience with PHP is rathor minor I'm not quite shure if it is a good idea to include sensitive data like API-Keys the way i did. So any suggestion on how to improve this is welcome :)

My basic setup:

  1. A section that includes an input for a (private) flickr photoset_id
  2. A datasource that outputs the id of the photoset as a parameter ($ds-flickr-photoset-id)
  3. A dynamic datasource to perform the flickr-api-call

My datasource-manipulations:

  1. Removed the URL by editing "public $dsParamURL" in the DS-file.
  2. Built the custom API-URL at the beginning of "public function grab" in the DS-file.

I've commented the code to explain the single steps I took to build signature and URL inside the DS:

// 1. SET UP DATA //

// 1.1 Grab Photoset-ID from Parameter Pool
$photoset_id = $this->_env['env']['pool']['ds-flickr-photoset-id']['0'];

// 1.2 Set API Secret
// - has to be the first parameter when building the signature
$secret = '############';

// 1.3 Set other parameters
// - These parameters have to be sorted alphabetically (by key) when building the signature - this is done in step 2
// - 'Extras' can be a single value or a comma-separated array
// - Additional API-parameters can be added
$api = array(
    'api_key' => '############',
    'auth_token' => '############',
    'method' => 'flickr.photosets.getPhotos',
    'format' => 'rest',
    'extras' => array('url_z','tags'),              
    'photoset_id' => $photoset_id
);



// 2. BUILD SIGNATURE & URL //

// 2.1 Setup Basics
$api_sig = $secret;
$api_url = 'http://api.flickr.com/services/rest/?';

// 2.2 Add sorted parameters
ksort($api, SORT_STRING);
foreach ($api as $key => $val) {
    if ( is_array($val)) {
    ksort($val, SORT_STRING);
    $val = implode(",", $val);
}
$api_sig = $api_sig.$key.$val;
$api_url = $api_url.$key.'='.$val.'&';
}       

// 2.3 Finalize
$api_sig = md5($api_sig);
$api_url = $api_url.'api_sig='.$api_sig;



// 3. ATTACH URL TO DATASOURCE
$this->dsParamURL = $api_url;

This is my first attempt in dealing with the Flickr-API but I guess this solution could be easily adopted for nearly any other request that needs authentification...

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details