I have been working for hours to get this works the problem is that when I first execute this code everything is ok but second time nothing displays. Then I realized that if I wait 20-25 seconds gets executed as expected I am using this way
whois("google","web.tr")
I dont get any problem the other extensions(com,net) so on
What I have tried:
function whois($domainName, $ext)
{
$servers = array(
"biz" => "whois.neulevel.biz",
"com" => "whois.internic.net",
"us" => "whois.nic.us",
"info" => "whois.nic.info",
"name" => "whois.nic.name",
"net" => "whois.internic.net",
"tv" => "whois.nic.tv",
"ru" => "whois.ripn.net",
"org" => "whois.pir.org",
"com.tr" => "whois.nic.tr",
"gen.tr" => "whois.nic.tr",
"web.tr" => "whois.nic.tr",
"k12.tr" => "whois.nic.tr",
"org.tr" => "whois.nic.tr"
);
$serverName = trim($servers[$ext]);
$tamAd=$domainName.".".$ext;
$whois = array();
$output = "";
if (function_exists('curl_version')) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $serverName);
curl_setopt($curl, CURLOPT_PORT, 43);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_TIMEOUT, 5);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $tamAd. "\r\n");
$result = curl_exec($curl);
curl_close($curl);
print_r($result);
} else {
trigger_error('cURL is not found!');
exit();
}
}
whois("google","web.tr");