get large flickr photos based on topic


/ Published in: PHP
Save to your folder(s)

ability to save files as well


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.