Results 1 to 9 of 9
  1. #1
    Join Date
    Jun 2004
    Posts
    199

    Thumbs up Free Whois Script Code is inside

    Free Whois Script Code is inside

    PHP Code:
    $whois = array ( 
        
    ".com"    =>    array ("type" => "Commercial",         "server" => "whois.internic.net"), 
        
    ".net"    =>    array ("type" => "Network",         "server" => "whois.internic.net"), 
        
    ".org"    =>    array ("type" => "Organisation",    "server" => "whois.internic.net"), 
        
    ".edu"    =>    array ("type" => "Education",         "server" => "whois.internic.net"), 
        
    ".gov"    =>    array ("type" => "Government",         "server" => "whois.nic.gov"), 
        
    ".biz"    =>    array ("type" => "Business",         "server" => "whois.pacificroot.com"), 
        
    ".name"    =>    array ("type" => "Name",         "server" => "whois.nic.name"), 
        
    ".info"    =>    array ("type" => "Information",     "server" => "whois.afilias.info"), 
        
    ".au"    =>    array ("type" => "Australia",         "server" => "whois.ausregistry.net"), 
        
    ".ca"    =>    array ("type" => "Canada",         "server" => "whois.cira.ca"), 
        
    ".de"    =>    array ("type" => "Germany",         "server" => "whois.denic.de"), 
        
    ".dk"    =>    array ("type" => "Denmark",         "server" => "whois.dk-hostmaster.dk"), 
        
    ".fr"    =>    array ("type" => "France",         "server" => "whois.nic.fr"), 
        
    ".ru"    =>    array ("type" => "Russia",         "server" => "whois.ripn.net"), 
        
    ".uk"    =>    array ("type" => "United Kingdom",     "server" => "whois.nic.uk"), 
        
    ".us"    =>    array ("type" => "United States",     "server" => "whois.us"), 
    ); 

    echo 
    "<HTML>\n"
    echo 
    "<HEAD>\n"
    echo 
    "    <TITLE>Whois</TITLE>\n"
    echo 
    "</HEAD>\n\n"
    echo 
    "<BODY>\n"
    echo 
    '    <FORM METHOD="POST" ACTION="'"{$PHP_SELF}"'">'"\n"
    echo 
    '        Domain: <INPUT TYPE="text" NAME="domain" VALUE="'"{$domain}"'" SIZE="30">&nbsp;'"\n"
    echo 
    '        <INPUT TYPE="submit" VALUE="Lookup">'"\n"
    echo 
    '    </FORM>'

    if (!empty (
    $domain)) 

        echo 
    '<BR>'"\n"'<HR NOSHADE>'"\n"

        
    $tld explode ("."$domain); 
        
    $tld "." $tld[count($tld)-1]; 
        if (!
    array_key_exists ($tld$whois)) 
        { 
            die (
    "This script currently does not support the {$tld} TLD."); 
        } 

        
    ob_start(); 
        
    system ("whois -h {$whois[$tld]["server"]} {$domain}"); 
        
    $whoisdata ob_get_contents(); 
        
    ob_end_clean(); 
        
    $whoisdata_txt "<textarea cols=\"150\" rows=\"15\" readonly style=\"font:11px tahoma;\">$whoisdata</textarea>"
        
    print_r (eregi_replace ("\n""\n"$whoisdata_txt)); 


    echo 
    '    </BODY>'"\n"'</HTML>'"\n"

  2. #2
    Join Date
    Jul 2002
    Location
    Kuwait
    Posts
    10,573
    doesn't work for me though bashar.com/whois.php
    Bashar Al-Abdulhadi - KuwaitNET Internet Services Serving customers since 1997
    Kuwait's First Webhosting and Domain Registration provider - an ICANN Accredited Registrar

    Twitter: Bashar Al-Abdulhadi

  3. #3
    Join Date
    Feb 2005
    Location
    Estonia
    Posts
    47
    Doesn't work for me , it seems like my host has disabled system()
    But thanks anyway!

  4. #4
    Join Date
    Jun 2004
    Posts
    199
    it works

    did you put php tags to beginning and end

    <?php
    $whois = array (
    ".com" => array ("type" => "Commercial", "server" => "whois.internic.net"),
    ".net" => array ("type" => "Network", "server" => "whois.internic.net"),
    ".org" => array ("type" => "Organisation", "server" => "whois.internic.net"),
    ".edu" => array ("type" => "Education", "server" => "whois.internic.net"),
    ".gov" => array ("type" => "Government", "server" => "whois.nic.gov"),
    ".biz" => array ("type" => "Business", "server" => "whois.pacificroot.com"),
    ".name" => array ("type" => "Name", "server" => "whois.nic.name"),
    ".info" => array ("type" => "Information", "server" => "whois.afilias.info"),
    ".au" => array ("type" => "Australia", "server" => "whois.ausregistry.net"),
    ".ca" => array ("type" => "Canada", "server" => "whois.cira.ca"),
    ".de" => array ("type" => "Germany", "server" => "whois.denic.de"),
    ".dk" => array ("type" => "Denmark", "server" => "whois.dk-hostmaster.dk"),
    ".fr" => array ("type" => "France", "server" => "whois.nic.fr"),
    ".ru" => array ("type" => "Russia", "server" => "whois.ripn.net"),
    ".uk" => array ("type" => "United Kingdom", "server" => "whois.nic.uk"),
    ".us" => array ("type" => "United States", "server" => "whois.us"),
    );

    echo "<HTML>\n";
    echo "<HEAD>\n";
    echo " <TITLE>Whois</TITLE>\n";
    echo "</HEAD>\n\n";
    echo "<BODY>\n";
    echo ' <FORM METHOD="POST" ACTION="', "{$PHP_SELF}", '">', "\n";
    echo ' Domain: <INPUT TYPE="text" NAME="domain" VALUE="', "{$domain}", '" SIZE="30">&nbsp;', "\n";
    echo ' <INPUT TYPE="submit" VALUE="Lookup">', "\n";
    echo ' </FORM>';

    if (!empty ($domain))
    {
    echo '<BR>', "\n", '<HR NOSHADE>', "\n";

    $tld = explode (".", $domain);
    $tld = "." . $tld[count($tld)-1];
    if (!array_key_exists ($tld, $whois))
    {
    die ("This script currently does not support the {$tld} TLD.");
    }

    ob_start();
    system ("whois -h {$whois[$tld]["server"]} {$domain}");
    $whoisdata = ob_get_contents();
    ob_end_clean();
    $whoisdata_txt = "<textarea cols=\"150\" rows=\"15\" readonly style=\"font:11px tahoma;\">$whoisdata</textarea>";
    print_r (eregi_replace ("\n", "\n", $whoisdata_txt));
    }

    echo ' </BODY>', "\n", '</HTML>', "\n";
    ?>

  5. #5
    Join Date
    Jul 2002
    Location
    Kuwait
    Posts
    10,573
    Ferman come on i added php tags ofcourse

    as u notice it show everything but doesn't show the output
    does it need write permission to the dir its running from?

    or maybe as hanz said system() is disabled on most hosts thats why it doesnt work.
    Bashar Al-Abdulhadi - KuwaitNET Internet Services Serving customers since 1997
    Kuwait's First Webhosting and Domain Registration provider - an ICANN Accredited Registrar

    Twitter: Bashar Al-Abdulhadi

  6. #6
    Join Date
    Feb 2003
    Location
    Connecticut
    Posts
    5,441
    If you have SAFE_MODE on in PHP, it disallows system/exec/et cetera.

    That's probably what's wrong.

  7. #7
    Join Date
    Jun 2004
    Posts
    199
    Originally posted by Bashar
    Ferman come on i added php tags ofcourse

    as u notice it show everything but doesn't show the output
    does it need write permission to the dir its running from?

    or maybe as hanz said system() is disabled on most hosts thats why it doesnt work.
    ferman.net/whois.php
    works fine for me

    tried it in many ways
    if you search domains with "www" it does not show the output
    if you do not put <?php and ?> it does not show the output

  8. #8
    Join Date
    Feb 2003
    Location
    Connecticut
    Posts
    5,441
    PHP Code:
    $domain ereg_replace('www.','',$domain); 
    That'll remove the www. automatically

  9. #9
    Join Date
    Jul 2002
    Location
    Kuwait
    Posts
    10,573
    bashar.com/whois.txt is the source, have a look

    plus i dont run safe_mode phpsuexec all the way
    Bashar Al-Abdulhadi - KuwaitNET Internet Services Serving customers since 1997
    Kuwait's First Webhosting and Domain Registration provider - an ICANN Accredited Registrar

    Twitter: Bashar Al-Abdulhadi

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •