1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26-27--28 29---30 31--32 33 34 35 36 37 38-39 40 41 42 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
<?php/** * Collection of the latest list of China Proxy Server network */class Proxy {/* need to collect list/public $list;/* Proxy list save path * * Public $save _path = ' proxy.txt '; /* Get capture list/function Get_list ($page) {$url = ' http://www.cnproxy.com/proxy (*). html ';//Process list $this->list = Preg_repla CE ('/(*)/', $page, $url); return $this->list; /* Collection Agent content/function get ($page) {$this->get_list ($page); $file = Stripslashes (file_get_contents ($this->list)); $zz = '/<tr><td> ([0-9.] +) <script type=text/javascript>document.write (":" ([+a-z]+)) </script></td><td>[w]+</ Td><td>[w,]+</td>/is '; Preg_match_all ($zz, $file, $temp); unset ($temp [0]); $th = Array (' z ', ' m ', ' k ', ' l ', ' d ', ' X ', ' I ', ' w ', ' Q ', ' B '); $th 2 = Array (3, 4, 2, 9, 0, 5, 7, 6, 8, 1); foreach ($temp [2] as $k => $v) {$v = Preg_replace ("/[+]+/", ", $v); $s = Str_replace ($th, $th 2, $v); $re. = $temp [1][$k ] . ':' . $s. "RN"; $this->save ($re); return true; } * * Save/Function Save ($re) {return file_put_contents ($this->save_path, $re, File_append)}/* Read/function reads () {return file_get_contents ( $this->save_path); }//Initialization collection Class $p = new Proxy; $start = 1; $end = 10; Control if ($_get[' a '] = = ' start ') {echo ' is sending acquisition request '; Echo ' <meta http-equiv= ' Refresh ' content= ' 3; Url=?p=1 ">"; } elseif (Isset ($_get[' P ')) {$i = $_get[' P ']++; if ($i >= $end + 1) {exit (' <meta http-equiv= "Refresh" content= "0; Url=?a=end ">"); else {echo ' is requesting list '. $i. ' > '. $end; if ($p->get ($i)) {echo ' <meta http-equiv= ' Refresh ' content= ' 3; url=?p= '. $_get[' P ']++. ' > '; }} elseif ($_get[' a '] = = ' End ') {echo ' collected ';} else {echo ' <form> <input type= ' hidden ' name= ' a ' value= ' start "/> <input type=" Submit "value=" began to collect "/> </form>"; }?> |