Free PHP5 Script to grab YOUR flickr Photos

UPDATED: To support Curl, if it is installed. It appears that some servers have the ‘fopen’ wrapper disabled, preferring Curl – which is faster too ! )

OK, so I have just knocked up a PHP5 script which, WITH SOME MORE WORK (on your part) will grab all your photos from flickr, should you want to move away from them.

This script takes your screen name and then lists all your photos, with the original photo file url, the title, description and any tags, comments and geocoding data too.

That’s as far as I go – the script is not doing any downloading at all – I leave the rest up to you :) You could add the details to a database, store images anywhere you like, ftp them somewhere – it’s up to you to get the PHP to do what you want.

If I get the time, I will create a desktop version which does the same thing. The tricky bit might be deciding on a static xml format for all the rest of the data – maybe a big RSS file would do. Or OPML. Or both?

Here is the PHP5 SOURCE.

NB: You MUST have PHP5 with simplexml and fopen wrappers or Curl activated (Some webhosts prefer you to use Curl, so they deactivate file_get_contents)

Enjoy! Feel free to use this code and hack and mash it up at will. Please add to the comments of this post, if you do extend it. Cheers! :)

23 Responses to “Free PHP5 Script to grab YOUR flickr Photos”


  1. 1 mrlk January 31, 2007 at 6:17 pm

    you didnt have anything to do with the beebs comments earlier about flickr account users being miffed at the yahoo id thing ? ;)

  2. 2 kosso January 31, 2007 at 6:19 pm

    Heh . No. Over 700 replies to the post from flickr did that! :)
    http://flickr.com/forums/help/32687/page8/#reply164982

  3. 3 l.tree January 31, 2007 at 6:51 pm

    Thanks for this! It’s exactly what I’m looking for. Sadly though, I’m getting the following errors. Think I did something wrong? This is a fresh api key, I entered it into the script as directed.

    Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in (my path to the script) on line 65

    Warning: file_get_contents(http://api.flickr.com/services/rest/?api_key=xxxxxxxxxxxxedit out ant the request of the commenter xxxxxxxxxxxxxxxxxx&method=flickr.people.findByUsername&username=myusername) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in (my path to the script) on line 65

    Fatal error: Call to undefined function: simplexml_load_string() in (my path to the script) on line 66

  4. 4 l.tree January 31, 2007 at 6:55 pm

    Oops, would you mind editing out my key? Sorry, new at this.

  5. 5 kosso January 31, 2007 at 7:06 pm

    Hi,

    this looks like your server cont allow the file_get_contents

    There is another way I could do this, if you cant change your config.

    using fopen etc…

  6. 6 kosso January 31, 2007 at 7:07 pm

    From the php page about this function

    “Tip: You can use a URL as a filename with this function if the fopen wrappers have been enabled. See fopen() for more details on how to specify the filename and Appendix M for a list of supported URL protocols.”

  7. 7 kosso January 31, 2007 at 7:07 pm

    Or I could do a version which uses ‘curl’, if you have that

  8. 8 kosso January 31, 2007 at 7:08 pm

    ALSO – It looks like you dont have the ‘simplexml’ functions

    NB: You MUST have PHP5 with simplexml and fopen wrappers activated

  9. 9 TranceMist January 31, 2007 at 7:41 pm

    Hey, nice hack.

    Personally, I think Flickr’s announcements today are no big deal.

    However, I’ve love to see another photo sharing site use something like this to give me the option of moving my photos over one day if I wanted to. Options are good. :)

  10. 10 kosso January 31, 2007 at 7:52 pm

    Zooomr will have this option in version III ;)

    Very much like I was able to import all my old blogger.com posts here, when I moved to WordPress

  11. 11 l.tree January 31, 2007 at 8:15 pm

    Ah, gotcha. I just checked and sure enough, my host has disabled file_get_contents and fopen. I’ll try to hack together a workaround. Thanks a bunch!

  12. 12 kosso January 31, 2007 at 10:06 pm

    Does your host support ‘curl’ ?

  13. 13 l.tree January 31, 2007 at 10:39 pm

    Yep, it does support curl, in fact it recommends curl as an alternative to the unsupported php functions.

  14. 14 Fran February 1, 2007 at 6:43 pm

    Er, now that you did this, could you work on a blogHUD to OPML blog thingie, so I can do posts like Dedrice Mauriac?
    Doesn’t hurt to ask now, does it? :-)

  15. 15 kosso February 1, 2007 at 6:53 pm

    Post to OPML blog? I have been asking Dave about supporting that for a while. What do you mean about Dedric’s posts? eh? What’s he been up to?

  16. 16 Fran February 1, 2007 at 6:58 pm

    He posts to WOrdpress the dear. Here’s the url, even though I suspect you’ve seen this:
    http://dedricmauriac.wordpress.com/

  17. 17 kosso February 1, 2007 at 7:11 pm

    Ooooh. you just mean crosspost to a blog via bloghud? Unfortunately, the OPML blogs don’t support the MetaWeblog API – which I find odd in a way.

    If you want to do that, you’d have to switch to one of the supported blogging systems.

    (another reason why my OPML blog doesn’t have (as) much activity these days ;) )

  18. 18 Fran February 1, 2007 at 7:45 pm

    Eeek! WordPress it is, then.:-)
    By the way, that’s a really long finger.

  19. 19 kosso February 1, 2007 at 11:00 pm

    All the better for wagging and pointing at things.

  20. 20 kosso February 1, 2007 at 11:11 pm

    Also, there’s no reason why you cant get an rss widget and slap that on your OPML blog, so ppl and still see what’s going on.

  21. 22 Purush June 3, 2008 at 7:57 am

    It works good for me


  1. 1 Weg bij Flickr? at TibsBits Trackback on February 1, 2007 at 9:16 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Who is this ‘kosso’ anyway?

I am a 'Createc'. A creative technologist, entrepreneur/ hacker/ geek. Worked on building things on the web for over 12 years.

Used to work at BBC News interactive and created the publishing and delivery systems for video news to get distributed on huge screens in major railway stations around the country.

I left the BBC to become CTO / sole-lead architect/developer at podcast.com for three years.

I have now left them to build a start up a new system called 'Phreadz', which is a 'Social Multimedia Conversation Network', integrating everything that is 'V.I.T.A.L' to us on the web. Video, Images, Text, Audio and Links.

I built the whole thing my myself. I programmed every line of code and positioned every pixel. I'm looking forward to attracting an hiring new members of the team to help me out! :)

There are currently over 1000 happy and helpful beta testers on the system so far and one client of a white-labelled solution.



@kosso : twitter

Error: Twitter did not respond. Please wait a few minutes and refresh this page.

kosso's flickr stream

Bristol Panoramic

Printed Paint-pot Angel

Mobile Lovers

Paint Pot Angel

The Punishment Book

School Days

School Days

School Days

School Days

School Days

More Photos
January 2007
M T W T F S S
« Dec   Feb »
1234567
891011121314
15161718192021
22232425262728
293031  

stats

  • 246,648

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: