English 中文(简体)
共同开发一个领域研究工具
原标题:Coding a domain lookup tool

我一直把一个域名核对器捆绑起来,并且实际上与营地隔绝。 这是我迄今为止所做的事情:

<?php
set_time_limit(0);
ob_start();
$domain = $_GET[ domain ];
########### Extensions to be checked
$extensions = array(
     .com       => array( whois.crsnic.net , No match for ),
     .info      => array( whois.afilias.net , NOT FOUND ),  
     .net       => array( whois.crsnic.net , No match for ),
     .co.uk     => array( whois.nic.uk , No match ),        
     .nl        => array( whois.domain-registry.nl , not a registered domain ),
     .ca        => array( whois.cira.ca ,  AVAIL ),
     .name      => array( whois.nic.name , No match ),
     .ws        => array( whois.website.ws , No Match ),
     .be        => array( whois.ripe.net , No entries ),
     .org       => array( whois.pir.org , NOT FOUND ),
     .biz       => array( whois.biz , Not found ),
     .tv        => array( whois.nic.tv ,  No match for ),
);
###########

if(isset($domain))
{
    $newdomain = str_replace(array( www. ,  http:// ), NULL, $domain);
    $finaldomain = str_replace($extensions, NULL, $newdomain);

    if(strlen($finaldomain) > 0)
    {
        foreach($extensions as $extension => $who)
        {
            $buffer = NULL;

            $sock = fsockopen($who[0], 43) or die( Error Connecting To Server:  . $server);
            fputs($sock, $finaldomain.$extension . "
");

                while( !feof($sock) )
                {
                    $buffer .= fgets($sock,128);
                }

            fclose($sock);

            if(eregi($who[1], $buffer))
            {
                echo  <h4 class="available"><span>Available</span>  . $finaldomain.  <b>  . $extension . </b> is Available</h4> ;
            }
            else
            {
                echo  <h4 class="taken"><span>Taken</span>  . $finaldomain .  <b>  .$extension . </b> is Taken</h4> ;
            }
            echo  <br /> ;  

            ob_flush();
            flush();
            sleep(0.3);

        }
    }
    else
    {
        echo  Please enter the domain name ;
    }
}
?>

我面临的问题是,我不知道如何从过去的领域取消延期。

然后,当结果回归时,即希望延期成为结果清单中的第一个。

I am new to php but need this for my project. All help appreciated.

Thanks Joe

问题回答

首先,extension称作top-level area(简称TLD)。 第二,.co.uk 不是顶级域,.uk。 它还有其他次域,如<代码>.org.uk、.gov.uk等。

现在,为了归还extension的一部分档案名称/名称,你可使用pathinfo:

$tld = pathinfo( helloworld.co.uk , PATHINFO_EXTENSION);
echo $tld;   // uk

您也许必须修改您的阵列,以删除你提出的标题,或者简单地:

$tld =  .  . pathinfo( helloworld.co.uk , PATHINFO_EXTENSION);
$whois_server = $extensions[$tld];

不要让所有人 • 每一顶级域名服务器,只能查询<代码>TLD.whois-servers.net。

http://en.wikipedia.org/wiki/Whois#Server_name_aliases_under_whois-servers.net”rel=“nofollow” Wikipedia:

whois-servers.net provides DNS alias records (CNAME) for TLD WHOIS servers of the form .whois-servers.net. The GNU WHOIS utility automatically uses the whois-servers.net service.





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签