시소당
whois검색 소스가 phpschool에도 몇개 올라와 있는데, 나같은 초보자가 보기에는
너무 어려웠습니다. 그래서 시스템관리자로써 리눅스서버에 익숙한 관계로 리눅스상의
whois 프로그램을 적절히 활용해 보았습니다.
간단한 소스이지만, 검색이 안되는 도메인이 없습니다. 유용하게 사용하시길...
<!-----------------------------------------------------
1. Program ID : domain.php
2. Program 개요 : 초간단 whois 검색
3. 작 성 일 : 2003. 5. 3
4. 작 성 자 : 한 상 헌
5. 주의 사항 : 소스를 사용하시기 전에 aaa.txt파일을 생성하시고,
퍼미션은 777을 주셔야 합니다. 그리고
$fp변수 부분의
경로설정을 여러분의 시스템경로와 일치시켜주세요..
------------------------------------------------------->
<html>
<head>
<title>whois 도메인 검색</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
</head>
<body bgcolor="#FFFFFF">
<form name="domain" method="post" action="domain.php">
<p>도메인을 입력하세요.</p>
<p> 도메인: www.
<input type="text" name="domain">
</p>
<?
$f = escapeshellcmd(
$domain);
$res = stristr(
$f,".kr");
if(
$res) {
exec("whois -h whois.krnic.net
$f > aaa.txt");
} else {
exec("whois -h whois-servers.net
$f > aaa.txt");
}
$fp = fopen("/home/domain/public_html/aaa.txt","r");
while(!feof(
$fp)) {
$chr = fgetc(
$fp);
if(!strcmp(
$chr,"\n")) {
$chr .= "<br>";
}
$line .=
$chr;
}
echo "
$line";
fclose(
$fp);
?>
</form>
</body>
<html>