Flickr api example in PHP / Scraping flickr images
My client needed to automate Flickr image search. They wanted a PHP script that uses Flickr API to scrape and save pictures related to keywords with creative commons license.
Also they needed to be able to filter pictures by size and number of favorites (likes). Here is the solution.
I decided to start with something simple, for example a page that searches and shows pictures and information without saving. Like this.
At first I created an app and googled for a decent Flicker API wrapper in PHP. Alas, I couldn’t find anything useful.
Some libraries just didn’t work right out of the box. Moreover they didn’t report any errors at all. And I didn’t feel like debugging them either. Others looked too overengineered for such a simple task.
So I used this simple example and rolled my own Flickr API wrapper.
Nothing fancy here, just doing requests to Flickr API and returning results. Simple and just works.
And here is example that searches pictures by tag provided, and shows only big ones with number of favorites >= 5.
You can check full example in the Github repo.