Advertisement
opsftw

proxy()

May 29th, 2016
799
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.07 KB | None | 0 0
  1. <?php
  2. /* Function: proxy()
  3.  * Desc: Grab proxy lists
  4.  * Args:
  5.  * $type: Type of proxy
  6.  *     types - usa, ssl, uk, socks, anonymous
  7.  * Author: Kai (Tux./YingYang/EgoInc)
  8.  */
  9. function proxy($type) {
  10.     $types = array(
  11.         'usa'=>'http://www.us-proxy.org/',
  12.         'ssl'=>'http://www.sslproxies.org/',
  13.         'uk'=>'http://free-proxy-list.net/uk-proxy.html',
  14.         'socks'=>'http://www.socks-proxy.net/',
  15.         'anonymous'=>'http://free-proxy-list.net/anonymous-proxy.html'
  16.     );
  17.     if(!isset($types[$type])) {
  18.         return "Usage: ?type={Proxy type}\nTypes: usa, ssl, uk, socks, anonymous";
  19.     }
  20.     $source = file_get_contents($types[strtolower($_GET['type'])]);
  21.     preg_match_all('/<tbody>(.*?)<\/tbody>/is', $source, $matches);
  22.     $array = explode("\n", $matches[1][0]);
  23.     $return = array();
  24.     foreach($array as $line) {
  25.         $line = explode(str_replace('</tr></td>','',str_replace('<tr><td>','',$line)),$line);
  26.         if(isset($line[0]) && isset($line[1])) {
  27.             $return[] = array($line[0], $line[1]);
  28.         }
  29.     }
  30.     return json_encode($return);
  31. }
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement