Advertisement
Guest User

GSA Proxy Scraper - web-export script in php

a guest
Nov 9th, 2016
539
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.34 KB | None | 0 0
  1. <?php
  2.   // GSA Proxy Scraper - web-export script in php
  3.   // http://www.proxy-scraper.com/
  4.  
  5.   //where should the data be saved?
  6.   $save_file="./proxies.txt";
  7.  
  8.   //whats the variable name of the file used in POST/GET header?
  9.   $parameter="file";
  10.  
  11.   //----------------------------------------------------------------------------
  12.  
  13.   //check if there are data in $_FILES
  14.   if(count($_FILES)>0) {
  15.     if (move_uploaded_file($_FILES[$parameter]['tmp_name'], $save_file)) {
  16.       echo 'File saved to "'.$save_file.'".';
  17.     } else {
  18.       header($_SERVER["SERVER_PROTOCOL"]." 400 Bad Request");
  19.       echo 'Unable to save file to "'.$save_file.'".'."\n";
  20.       echo "More debug data follow:\n";
  21.       print_r($_FILES);
  22.     }
  23.   } else {
  24.     if(isset($_POST[$parameter])) { $data=$_POST[$parameter]; }
  25.     elseif(isset($_GET[$parameter])) { $data=$_GET[$parameter]; }
  26.     if($data!="") {
  27.       $fp=fopen($save_file,"w");
  28.       if(!$fp) {
  29.         header($_SERVER["SERVER_PROTOCOL"]." 400 Bad Request");
  30.         echo 'Unable to save file to "'.$save_file.".\n";
  31.       } else {      
  32.         fwrite($fp,$data);
  33.         fclose($fp);
  34.         echo 'Data saved to "'.$save_file.'".';
  35.       }      
  36.     } else {
  37.       header($_SERVER["SERVER_PROTOCOL"]." 400 Bad Request");
  38.       echo 'No content defined in "'.$parameter.".\n";
  39.     }
  40.   }
  41. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement