PHP whois通过代理

时间:2014-10-17 10:43:14

标签: php curl proxy whois

我有这个PHP脚本来获取域的whois信息。它工作,但当我尝试通过代理连接whois服务器,然后它不起作用。我做错了什么?谢谢你的帮助。

$server = "whois.nic.cz";
$domain = "ucedan.cz";

function QueryWhoisServer($server, $domain){
    $proxy = "85.111.25.189:8080";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $server);
    curl_setopt($ch, CURLOPT_PORT, 43);
    curl_setopt($ch, CURLOPT_PROXY, $proxy);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 30);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $domain . "\r\n");
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;  
}

0 个答案:

没有答案