Simple Whois Scripts....FREE

Discussion in 'Other Programming' started by midlandi, May 31, 2007.

Thread Status:
Not open for further replies.
  1. midlandi Can you smell that?

    Member Since:
    Jan 22, 2007
    Message Count:
    4,769
    Likes Received:
    36
    Location:
    Uk
    Found this Free Script, thought it might be usefull for somone

    Three Perl scripts in one. The good whois script allows users to search for .com .net .org and all UK Domain Name extensions. The multi whois allows multiple Domain Names to be searched in one go and the name whois allows users to check the availability of .name Domain Names.

    http://www.polyspaston.com/content_simple.php
  2. gkd Active Member

    Member Since:
    Apr 16, 2007
    Message Count:
    1,738
    Likes Received:
    16
    Location:
    UK
    Interesting script Midlandi

    Thanks for sharing
  3. soori New Member

    Member Since:
    May 28, 2007
    Message Count:
    26
    Likes Received:
    0
    Thanks for the great tip
  4. dhscott New Member

    Member Since:
    May 22, 2007
    Message Count:
    96
    Likes Received:
    2
    The good thing about these type of simple scripts is that they are easy to edit. The trouble with something like my script (for qwhois.net) is that it can be easy to add new extensions (or edit servers) but it can be difficult to change the way in which the script works because it is quite complex!

    Keep it simple, it works :)
  5. midlandi Can you smell that?

    Member Since:
    Jan 22, 2007
    Message Count:
    4,769
    Likes Received:
    36
    Location:
    Uk
    Should be php ...

    PHP:

    <?php
    function determine_whois_server( $domain )
    {
        /** NOT FINISHED, I REPEAT NOT FINISHED **/
        switch( @end( explode( ".", $domain ) ) )
        {
            case 'com':
            case 'net':
            case 'edu':
                return "whois.internic.net";
            break;

            case 'org':
                return "whois.publicinterestregistry.net";
            break;

            case 'biz':
                return "whois.neulevel.biz";    
            break;
           
            case 'info':
                return "whois.affilias.info";
            break;        

            /** other registries here, can't be bothered ... **/

            /** uwhois will serve any domain, but it's slow as hell **/

            default: return "uwhois.com"; break;
        }
        /** NOT FINISHED, I REPEAT NOT FINISHED **/
    }
    function whois( $domain )
    {
        if( ( $sock = @fsockopen( determine_whois_server( $domain ), 43, $errno, $errstr, 5 ) ) )
        {
            $buffer =  array( );
           
            if( fwrite( $sock, "$domain\n" ) )
            {
                while( !feof( $sock ) )
                {
                    $buffer[ ] = fgets( $sock );
                }
            }
            fclose( $sock );

            if( count( $buffer ) )
            {
                return implode( null, $buffer );
            }
        }
        else printf( "Error connecting to socket: %s", $errstr );
    }
    /**
    * Example ( with cheeky plug )
    * echo whois( "interviolet.com" );
    **/

    ?>
     
Thread Status:
Not open for further replies.

Share This Page