function testsock4($ip, $port) { if (!$a = @fsockopen($ip, $port, $errno = NULL, $errstr = NULL, PROXY_CONNEC_TIMEOUT)) return false; $b = explode(':', CONNEC_SERVER); fputs($a, "\x04\x01".chr(($b[1] / pow(2,8))).chr($b[1] % pow(2,8))."\x00\x00\x00",chr(rand(1,255))."\x00".$b[0]."\x00"); @stream_set_timeout($a, PROXY_READ_TIMEOUT); $b = fgets($a); if ((isset($b{1})) && ($b{1} == "\x5A")) { $b = stream_get_contents($a); if (preg_match(SEARCH_REGEX, @$c[SEARCH_LINE-1])) return true; } return false; }