Posted By

nhassan on 08/03/09


Tagged


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

esritter
umang_nine


get large flickr photos based on topic


 / Published in: PHP
 

ability to save files as well

  1. <?php
  2. $json = 'http://api.flickr.com/services/rest/?format=json&method=flickr.photos.search&api_key=#&tags=handbags&sort=relevance&page=1';
  3. $json = file_get_contents( $json );
  4. $json = substr( $json, 14, strlen($json)-15 );
  5. $json = json_decode( $json, true );
  6.  
  7. foreach( $json['photos']['photo'] as $i => $d ) {
  8. $url = 'http://farm' . $d['farm'] . '.static.flickr.com/' . $d['server'] . '/' . $d['id'] . '_' . $d['secret'] . '_b.jpg';
  9.  
  10. // $image=file_get_contents( $url );
  11. // file_put_contents('dl2/' . $d['secret'] . '.jpg', $image);
  12.  
  13. // echo $d['secret'] . '.jpg';
  14. echo '<img src="' . $url . '" />';
  15. }
  16. ?>

Report this snippet  

You need to login to post a comment.