Page 1 of 1

Domain availability Checking

Posted: Sat Jul 10, 2010 12:28 pm
by agriz
Hi,

I need a script to check availability of the following domains.
.do
.com.do .edu.do .org.do .art.do .gov.do gob.do .sld.go .web.do .net.do .mil.do
I have a open source script which checks .com, .org, .net...

The script i am using is here

Re: Domain availability Checking

Posted: Sun Jul 11, 2010 7:57 am
by agriz

Code: Select all

<?php ini_set('display_errors', 0); ?> 
<?php
error_reporting(0);
$fp = fsockopen("www.agriz.biz", 80, $errno, $errstr, 30);
if (!$fp) {
    echo "Domain Not available";exit;
} else {
    $out = "GET / HTTP/1.1\r\n";
    $out .= "Host: www.example.com\r\n";
    $out .= "Connection: Close\r\n\r\n";
    fwrite($fp, $out);
    while (!feof($fp)) {
        $status .= fgets($fp, 128);
    }
    fclose($fp);
}

if(strpos($status,"HTTP/1.1 200 OK") === false){
	echo "Domain Not available";
}
else{
	echo "Domain Is Available";
}
?>
I wrote this script to check the header status of the domain. If it is "HTTP/1.1 200 OK" I assume the domain is already registered. otherwise it is not registered.

Is this correct idea?