我目前正在使用 PHP 打开端口 43 连接,以使用此代码直接从注册表获取 whois 信息。
// connecting to the whois server.
$handle = fsockopen($server, 43);
if (!$handle)
return false; // connection failure
//asking the server
fwrite($handle, $domain_name."\r\n");
// getting response
$response = '';
while (!feof($handle))
$response .= fgets($handle, 1024);
fclose($handle);
它工作得很好,但是我想通过代理服务器连接,所以我通过它路由我的互联网连接。如果这能够使用 cURL,我会使用 curl_setopt($curl_handle, CURLOPT_PROXY, $ip_address . ':4040'); 但我找不到使用 fsocketopen 的方法。如何使用 cURL 或 fsocketopen() 完成此操作?