document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. <?php
  2.  
  3. // Googled Downloading Images with cURL/Php and Adapted
  4.  
  5. $img[]=\'http://maps.googleapis.com/maps/api/staticmap?center=40.714728,-73.998672&zoom=10&size=600x600&maptype=hybrid&sensor=false\';
  6. $img[]=\'http://maps.googleapis.com/maps/api/staticmap?center=40.714728,-73.998672&zoom=11&size=600x600&maptype=hybrid&sensor=false\';
  7. $img[]=\'http://maps.googleapis.com/maps/api/staticmap?center=40.714728,-73.998672&zoom=12&size=600x600&maptype=hybrid&sensor=false\';
  8. $img[]=\'http://maps.googleapis.com/maps/api/staticmap?center=40.714728,-73.998672&zoom=13&size=600x600&maptype=hybrid&sensor=false\';
  9. $img[]=\'http://maps.googleapis.com/maps/api/staticmap?center=40.714728,-73.998672&zoom=14&size=600x600&maptype=hybrid&sensor=false\';
  10. $img[]=\'http://maps.googleapis.com/maps/api/staticmap?center=40.714728,-73.998672&zoom=15&size=600x600&maptype=hybrid&sensor=false\';
  11. $img[]=\'http://maps.googleapis.com/maps/api/staticmap?center=40.714728,-73.998672&zoom=16&size=600x600&maptype=hybrid&sensor=false\';
  12. $img[]=\'http://maps.googleapis.com/maps/api/staticmap?center=40.714728,-73.998672&zoom=17&size=600x600&maptype=hybrid&sensor=false\';
  13. $img[]=\'http://maps.googleapis.com/maps/api/staticmap?center=40.714728,-73.998672&zoom=18&size=600x600&maptype=hybrid&sensor=false\';
  14. $img[]=\'http://maps.googleapis.com/maps/api/staticmap?center=40.714728,-73.998672&zoom=19&size=600x600&maptype=hybrid&sensor=false\';
  15. $img[]=\'http://maps.googleapis.com/maps/api/staticmap?center=40.714728,-73.998672&zoom=20&size=600x600&maptype=hybrid&sensor=false\';
  16. $img[]=\'http://maps.googleapis.com/maps/api/staticmap?center=40.714728,-73.998672&zoom=21&size=600x600&maptype=hybrid&sensor=false\';
  17.  
  18.  
  19. foreach($img as $i){
  20.     save_image($i);
  21.     if(basename($i)){
  22.         echo \'<h3 style="color: green;">Image \' . basename($i) . \' Downloaded OK</h3>\';
  23.     }else{
  24.         echo \'<h3 style="color: red;">Image \' . basename($i) . \' Download Failed</h3>\';
  25.     }
  26. }
  27.  
  28. //Alternative Image Saving Using cURL seeing as allow_url_fopen is disabled - bummer
  29. function save_image($img,$fullpath=\'basename\'){
  30.     if($fullpath==\'basename\'){
  31.         $fullpath = basename($img);
  32.     }
  33.     $ch = curl_init ($img);
  34.     curl_setopt($ch, CURLOPT_HEADER, 0);
  35.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  36.     curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
  37.     $rawdata=curl_exec($ch);
  38.     curl_close ($ch);
  39.     if(file_exists($fullpath)){
  40.         unlink($fullpath);
  41.     }
  42.     $fp = fopen($fullpath.\'.png\',\'x\');
  43.     fwrite($fp, $rawdata);
  44.     fclose($fp);
  45. }
  46.  
  47.  
  48. ?>
');