msaracevic

CREST Proxy

Jun 1st, 2014
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.10 KB | None | 0 0
  1. <?php
  2.     if ($_GET['request_url'] =="http://public-crest.eveonline.com/incursions/"){
  3.        
  4.         $file = fopen("last_update.txt","r");
  5.         $contents = fread($file,filesize("last_update.txt"));
  6.         fclose($file);
  7.        
  8.         if(time()>($contents+3600)) {
  9.            
  10.             $file = fopen("last_update.txt","w");
  11.             fwrite($file,time());
  12.             fclose($file);
  13.            
  14.             $ch = curl_init($_GET['request_url']);
  15.            
  16.             curl_setopt($ch, CURLOPT_HEADER, 1);
  17.             curl_setopt($ch, CURLOPT_USERAGENT,'Site: put your site here or whatever, Contact: [email protected]');
  18.             curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  19.            
  20.             $remote_file = curl_exec($ch);
  21.            
  22.             $header_size = curl_getinfo($ch,CURLINFO_HEADER_SIZE);
  23.             $result['header'] = substr($remote_file, 0, $header_size);
  24.             $result['body'] = substr($remote_file, $header_size );
  25.            
  26.             //echo $result['header'];
  27.             echo $result['body'];
  28.            
  29.             curl_close($ch);
  30.            
  31.             $file = fopen("incursions.data","w");
  32.             fwrite($file,$result['body']);
  33.             fclose($file);
  34.         }
  35.        
  36.         else {
  37.             $file = file_get_contents("incursions.data");
  38.             echo $file;
  39.         }
  40.     }
  41.     else
  42.         echo "forbidden";
  43.  
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment