ช่วยหน่อยครับจนปัญญา เช็คโดเมนว่าง .co.th , in.th ยังไงครับ
Code
<?php
function checkDomain($domain,$server,$findText){
// Open a socket connection to the whois server
$con = fsockopen($server, 43);
if (!$con) return false;
// Send the requested doman name
fputs($con, $domain."\r\n");
// Read and store the server response
$response = ' :';
while(!feof($con)) {
$response .= fgets($con,128);
}
// Close the connection
fclose($con);
// Check the response stream whether the domain is available
if (strpos($response, $findText)){
return true;
}
else {
return false;
}
}
function showDomainResult($domain,$server,$findText){
if (checkDomain($domain,$server,$findText)){
echo "<tr><td>$domain</td><td>AVAILABLE</td></tr>";
}
else echo "<tr><td>$domain</td><td>TAKEN</td></tr>";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>MicroWhois domain checker</title>
<link href="style/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="main">
<div id="caption">DOMAIN LOOKUP</div>
<div id="icon"> </div>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="domain" id="domain">
Domain name:
<table>
<tr><td><input class="text" name="domainname" type="text" size="36"/></td></tr>
<tr>
<td>
<input type="checkbox" name="all" checked />All
<input type="checkbox" name="com"/>.com
<input type="checkbox" name="net"/>.net
<input type="checkbox" name="org"/>.org
<input type="checkbox" name="info"/>.info
<input type="checkbox" name="coth"/>.co.th
<input type="checkbox" name="inth"/>.in.th
</td></tr>
<tr><td align="center"><br/><input class="text" type="submit" name="submitBtn" value="Check domain"/></td></tr>
</table>
</form>
<?php
if (isset($_POST['submitBtn'])){
$domainbase = (isset($_POST['domainname'])) ? $_POST['domainname'] : '';
$d_all = (isset($_POST['all'])) ? 'all' : '';
$d_com = (isset($_POST['com'])) ? 'com' : '';
$d_net = (isset($_POST['net'])) ? 'net' : '';
$d_org = (isset($_POST['org'])) ? 'org' : '';
$d_info = (isset($_POST['info'])) ? 'info' : '';
$d_coth = (isset($_POST['coth'])) ? 'coth' : '';
$d_inth = (isset($_POST['inth'])) ? 'inth' : '';
// Check domains only if the base name is big enough
if (strlen($domainbase)>1){
?>
<div id="caption">RESULT</div>
<div id="icon2"> </div>
<div id="result">
<table width="100%">
<?php
if (($d_com != '') || ($d_all != '') ) showDomainResult($domainbase.".com",'whois.crsnic.net','No match for');
if (($d_net != '') || ($d_all != '') ) showDomainResult($domainbase.".net",'whois.crsnic.net','No match for');
if (($d_org != '') || ($d_all != '') ) showDomainResult($domainbase.".org",'whois.publicinterestregistry.net','NOT FOUND');
if (($d_info != '') || ($d_all != '') ) showDomainResult($domainbase.".info",'whois.afilias.net','NOT FOUND');
if (($d_coth != '') || ($d_all != '') ) showDomainResult($domainbase.".co.th",'whois.thnic.net','No entries');
if (($d_inth != '') || ($d_all != '') ) showDomainResult($domainbase.".in.th",'whois.thnic.net','No entries found');
?>
</table>
</div>
<?php
}
}
?>
<div id="source">Micro Whois 1.1</div>
</div>
</body>
Date :
2010-07-17 09:47:33
By :
bouy2208
whois.thnic.net
Date :
2011-06-06 21:11:21
By :
tt
เปลี่ยนเป็นแบบนี้แทนนะครับ
.in.th|https://www.thnic.co.th/domain_avail_api.php?domain=|HTTPREQUEST-1
.ac.th|https://www.thnic.co.th/domain_avail_api.php?domain=|HTTPREQUEST-1
.co.th|https://www.thnic.co.th/domain_avail_api.php?domain=|HTTPREQUEST-1
.go.th|https://www.thnic.co.th/domain_avail_api.php?domain=|HTTPREQUEST-1
.mi.th|https://www.thnic.co.th/domain_avail_api.php?domain=|HTTPREQUEST-1
.net.th|https://www.thnic.co.th/domain_avail_api.php?domain=|HTTPREQUEST-1
.or.th|https://www.thnic.co.th/domain_avail_api.php?domain=|HTTPREQUEST-1
ref: http://www.thaihosttalk.com/topic/31807-%E0%B8%95%E0%B8%AD%E0%B8%99%E0%B8%99%E0%B8%B5%E0%B9%89-whois-server-%E0%B8%82%E0%B8%AD%E0%B8%87-thnic-%E0%B8%9A%E0%B8%99-whmcs-%E0%B9%80%E0%B8%9B%E0%B9%87%E0%B8%99%E0%B8%AD%E0%B8%B0%E0%B9%84%E0%B8%A3%E0%B8%84%E0%B8%A3%E0%B8%B1%E0%B8%9A/
Date :
2011-06-09 10:19:27
By :
coca
Load balance : Server 03