设计初衷当然是用php curl bind不一个sokcet5去访问一个随机页面(公网)这个页面的功能就是通过一个md5来验证sokcet5服务器是否真的可用
A服务器通过 socket5发出http://www.xxorg.com/a.php?t=randkey
B服务器,echo md5($_GET[‘t’] . mykey);
A服务器拿到content以后也用相同算法算一个$resut看看是不是等于B服务器的echo值,如果一样,就是success 不一样就是failed
1.第一个文件curl.inc.php
10. * ’host’ => ”,
11. * ‘header’ => ”,
12. * ‘method’ => ”,
13. * ‘referer’ => ”,
14. * ‘cookie’ => ”,
15. * ‘post_fields’ => ”,
16. * ['login' => '',]
17. * ['password' => '',]
18. * ‘timeout’ => 0
19. * );
20. */
21. public function init($params)
22. {
23. if($this->ch==0)
24. $this->ch = curl_init();
25. $user_agent = ‘Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.0.9) Gecko/20061206 Firefox/1.5.0.9′;
26. $header = array(
27. "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5",
28. "Accept-Language: ru-ru,ru;q=0.7,en-us;q=0.5,en;q=0.3",
29. "Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7",
30. "Keep-Alive: 300");
31. if (isset($params[‘host’]) && $params[‘host’]) $header[]="Host: ".$params[‘host’];
32. if (isset($params[‘header’]) && $params[‘header’]) $header[]=$params[‘header’];
33.
34. @curl_setopt ( $this -> ch , CURLOPT_RETURNTRANSFER , 1 );
35. @curl_setopt ( $this -> ch , CURLOPT_VERBOSE , 1 );
36. @curl_setopt ( $this -> ch , CURLOPT_HEADER , 1 );
37. if(strlen($params[‘proxy’])>0) curl_setopt($this->ch, CURLOPT_PROXY,$params[‘proxy’]);
38. if(strlen($params[‘proxyport’])>0) curl_setopt($this->ch, CURLOPT_PROXYPORT, $params[‘proxyprot’]);
39. curl_setopt($this->ch,CURLOPT_PROXYTYPE,CURLPROXY_SOCKS5);
40. if ($params[‘method’] == "HEAD") @curl_setopt($this -> ch,CURLOPT_NOBODY,1);
41. @curl_setopt ( $this -> ch, CURLOPT_FOLLOWLOCATION, 1);
42. @curl_setopt ( $this -> ch , CURLOPT_HTTPHEADER, $header );
43. if ($params[‘referer’]) @curl_setopt ($this -> ch , CURLOPT_REFERER, $params[‘referer’] );
44. @curl_setopt ( $this -> ch , CURLOPT_USERAGENT, $user_agent);
45. if ($params[‘cookie’]) @curl_setopt ($this -> ch , CURLOPT_COOKIE, $params[‘cookie’]);
46.
47. if ( $params[‘method’] == "POST" )
48. {
49. curl_setopt( $this -> ch, CURLOPT_POST, true );
50. curl_setopt( $this -> ch, CURLOPT_POSTFIELDS, $params[‘post_fields’] );
51. }
52. @curl_setopt( $this -> ch, CURLOPT_URL, $params[‘url’]);
53. @curl_setopt ( $this -> ch , CURLOPT_SSL_VERIFYPEER, 0 );
54. @curl_setopt ( $this -> ch , CURLOPT_SSL_VERIFYHOST, 0 );
55. if (i