views:

144

answers:

2
+3  Q: 

Get Flickr Sets

Hi everyone.

Usual stuff, Googled forever, looked on here, no help. Yet.

What I want is to list the sets of photos I have on Flickr. Nice & simple, it would seem. I want the 'title image' (the one used as the thumb for it on Flickr its self), the title and URL. Can't be that hard, can it?

The language of choice is PHP (5.1.6), or JS (jQuery if possible). Both are good.

A: 

Using flickr.photos.search method of the API with your user_id does not work ?

For PHP, you have a PEAR-based package here and another library at http://phpflickr.com/. Should be enough to get through it.

EDIT :

For minimal implementation you should use stream_context_create() with HTTP headers, use fopen() with this context and build a XMLRPC request by hand as a text variable that you will send. Answer from the socket will be your data

For the API, use flickr.photosets.getList

CODE EXAMPLE (you need a valid api key for flickr)

<?php
$apiKey = '';
$userID = '';
$url = 'http://api.flickr.com/services/rest/?method=flickr.photosets.getList&amp;api_key='
    .$apiKey.'&user_id='.$userID.'&format=json';
$options = Array('http' => Array('method' => 'GET'));
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
$object = json_decode($response);
Serty Oan
The search documentation doesent seem to mention sets...I did look at http://phpflickr.com/ before, it just looks like a lot of overhead for one small piece of functionality that I want.
PaulAdamDavis
Ok, updated my answer to feed better your needs
Serty Oan
Thanks for updating that, Serty. You wouldn't have any sample code, or links to some would you?
PaulAdamDavis
Edited with a little code sample, i think this should work
Serty Oan
Once again, thanks Serty. file_get_contents is disabled on our servers, so I've has to use Curl, but this definitely got me going. I'm now seeing set titles on my page. I'll post up my final code when I'm done. Thanks again!
PaulAdamDavis
+1  A: 

see also http://framework.zend.com/manual/en/zend.service.flickr.html for a nice tidy wrapper

Steve