Javascript Ajax Flickr application
Embed your own Flickr mini-application in your web pages:
- Write a web page with Javascript
where you can enter a search term in a box
and it will:
-
Run a program on the server
(probably with PHP)
to:
- Fetch an
XML feed from Flickr (*)
of images with that tag,
and then:
-
Parse the XML on the client-side with Javascript
and show the images in some kind of display (be creative).
- Notes:
- Running a program on the server:
If you do not have CGI,
you do have PHP with arguments,
and PHP can:
- Run server-side commands
- Make HTTP requests directly
- Instead of the PHP outputting a HTML page in which you include the XML,
get the PHP to output XML only (no HTML). See:
header('Content-type: text/xml');
- To save load on Flickr's servers,
don't actually go to Flickr
to get the XML feed while you're debugging.
Use a saved XML file for debugging.
For the live version you can then test it going to Flickr at run-time.
- Flickr API
supports
JSON format
if you want to use that
(e.g. in workaround to same-origin policy).
- (*) This is a link to a lab where Shell is used to talk to Flickr and parse XML.
We will not use Shell here.
Here we will instead use PHP to talk to Flickr, and use Javascript to parse the XML.
-
What to hand up