Click here to Skip to main content
15,888,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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");
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900