PHP Scripts Development » PHP Classes Support Forum

Whois Class: Adding more tlds

(1 post)
  • Started 7 months ago by Olaf

Great offers not only for geeks!


  1. Adding more Tlds is very easy, just edit the file "server_list.php" and add new array values like:


    $servers['xx']['address'] = "whois.xx";
    $servers['xx']['free'] = "FREE";
    $servers['x']['param'] = "";

    Replace xx with your new tld
    address is the address you need for your query (search the website from the local domain publisher for this information or search google for "whois xx tld")

    The free string is something you can find on the Internet or while using this small snippet:


    <?php
    function get_whois_data($test_server, $test_domain) {
    $msg = "";
    $connection = fsockopen($test_server, 43, $errno, $errstr, 10);
    if (!$connection) {
    $msg = "Can't connect to the server!";
    } else {
    sleep(2);
    fputs($connection, $test_domain."\r\n");
    while (!feof($connection)) {
    $msg[] = fgets($connection, 4096);
    }
    fclose($connection);
    }
    return $msg;
    }
    print_r(get_whois_data("whois.nic.us", "finalwebsites.us"));
    ?>

    The last value param is only used for a few tlds, let it empty if not needed.

    There was also a forum thread on the previous support forum.

    Posted 7 months ago #

RSS feed for this topic

Reply

You must log in to post.