Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 11th, 2012  |  syntax: None  |  size: 1.73 KB  |  hits: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <html>
  2. <head><title>-- flickr --</title></head>
  3. <body>
  4.         <h1>BENVENUTO</h1>
  5.         <br>
  6.         <h3>Form di ricerca</h3>
  7.         <br><br>
  8.         <h5>Se vuoi disconnetterti clicca<A HREF="logout.php"> qui</A>.</h5>   
  9.  
  10.  
  11.        
  12. <?php
  13.  
  14.         /*Create API URL*/
  15.  
  16.         $params = array(
  17.                 'method'      => 'flickr.photos.search',
  18.                 'api_key'     => 'd6962e75bf21708f745f0bd610078bc3',
  19.                 #'user_id'     => '61415669@N05',
  20.                 'tags'            => 'italy',
  21.                 'sort'        => 'interestingness_desc',
  22.                 #'format'      => 'php_serial',
  23.  
  24.         );
  25.  
  26.         $encoded_params = array();
  27.  
  28.         foreach ($params as $k => $v){
  29.                 $encoded_params[] = urlencode($k).'='.urlencode($v);
  30.         }
  31.  
  32.         /*Open API URL and decode response as PHP values*/
  33.  
  34.         $url = 'http://api.flickr.com/services/rest/?'.implode  ('&', $encoded_params);
  35.        
  36.         print $url;
  37.  
  38.         $rsp = file_get_contents($url);
  39.  
  40.        
  41.         $xml = new SimpleXMLElement($rsp);
  42.        
  43.         print $xml->asXML();
  44.        
  45.        
  46.  
  47.  
  48.  
  49.        
  50.         //$file = simplexml_load_string($xml);
  51.         //$rsp_obj = unserialize($rsp);
  52.  
  53. ?>
  54.                
  55.                
  56.                
  57.                
  58.                
  59.          <!--
  60.  
  61.  
  62.  
  63.         /*HTML output*/
  64.  
  65.         if ($rsp_obj['stat'] !== 'ok'){
  66.                 echo ('It does not work');
  67.         }
  68.  
  69.         for ($i = 0; $i <= 3; $i++){
  70.                 /*Each array 'photo' in array 'photos' is given the index $i which is increased by 1 each               run*/
  71.                 $photo = $rsp_obj['photos']['photo'][$i];
  72.  
  73.                 /*Picture-Url*/
  74.                 $purl = 'http://farm'.$photo['farm'].'.'.'static'.'.'.'flickr.com/'.$photo['server'].'/'.               $photo['id'].'_'.$photo['secret'].'_s.jpg';
  75.  
  76.                 /*Flickr-Url*/
  77.                 $furl = 'http://www.flickr.com/photos/'.$photo['owner'].'/'.$photo['id'].'/';
  78.  
  79.                 /*Link-URL*/
  80.                 $lurl = '<a href="'.$furl.'">'.'<img alt="'.$photo['title'].'" src="'.$purl.'"                                  width="75px" /></a>';
  81.  
  82.                 /*Displays HTML code*/
  83.                 echo ($lurl);
  84.         }
  85.  
  86.  
  87.                
  88.                 */             
  89.  
  90.          -->
  91.  
  92. </body>
  93. </html>