| <? Php /** * Collect the latest list of proxy server networks in China */ Class proxy { /* List to be collected */ Public $ list; /* Save the proxy list path */ Public $ save_path = 'proxy.txt '; /* Obtain the collection list */ Function get_list ($ page) { $ Url = 'HTTP: // www.cnproxy.com/proxy (* pai.html '; // Processing list $ This-> list = preg_replace ('/\ (\ * \)/', $ page, $ url ); Return $ this-> list; } /* Collect proxy 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 '); $ 2nd = 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, $ YY, $ v ); $ Re. = $ temp [1] [$ k]. ':'. $ s. "\ r \ n "; } $ This-> save ($ re ); Return true; } /* Save */ Function save ($ re) { Return file_put_contents ($ this-> save_path, $ re, FILE_APPEND ); } /* Read */ Function read () { Return file_get_contents ($ this-> save_path ); } } // Initialize the collection class $ P = new proxy; $ Start = 1; $ End = 10; // Control If ($ _ GET ['a'] = 'start '){ Echo 'sending collection requests '; 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 'request list'. $ I. '>'. $ end; If ($ p-> get ($ I )){ Echo '<meta http-equiv = "Refresh" content = "3; URL =? P = '. $ _ GET ['P'] ++.' "> '; } } } Elseif ($ _ GET ['a'] = 'end '){ Echo 'collection completed '; } Else { Echo '<form> <Input type = "hidden" name = "a" value = "start"/> <Input type = "submit" value = "start collection"/> </Form> '; } ?> |