whois 도메인 검색이 안됩니다.
다음과 같은 소스를 얻어서 서버에 올리고 검색을 해보고있습니다.
소스는 제가 산 책에 있는 예제 입니다.
검색할 도메인을 적고 검색을 눌러도 도무지 검색이 안됩니다.
왜그런 건가요 ?
<html>
<head><title>WHOIS Gateway</title></head>
<body>
<center>
<font size=4 face=verdana color=NAVY>PHP WHOIS Gateway</font>
<br><br>
<form action="whois.php" method=GET>
<table width=400>
<tr><td align=center><font size=2 color=NAVY>도메인 / IP :
<input type=text name=query size=15>
<input type=submit value=" 검색 ">
</font>
<br><br>
</td>
</tr>
<tr><td><font size=2 color=NAVY><ul>
<li>ojj.co.kr 또는 ojj.com 과 같이 www는 입력하지 마세요.
<li>현재는 .kr도메인과 .com 도메인만 조회가 가능합니다.
<li>국내 IP도 조회할수 있습니다. (예, 123.123.234.222)
</ul>
</font>
</td>
</tr>
</table>
</form>
<?php
$whois_server1="whois.networksolutions.com";
$whois_server2="whois.nic.or.kr";
if ($query)
{
search_whois($query);
}
function search_whois ($query)
{
if ( eregi(".com$",$query) || eregi(".net$",$query)
|| eregi(".org$",$query))
{
$server=$GLOBALS[whois_server1];
}
else
{
$server=$GLOBALS[whois_server2];
}
$fp = fsockopen($server, 43, &$errno, &$errstr);
if(!$fp)
{
print_message("WHOIS 서버에 접속할수가 없습니다. 잠시후 다시 시>
도하세요");
return;
}
set_socket_blocking($fp, 1);
fputs($fp,"$query\n");
while ($buf=fgets($fp,255))
{
$result.=$buf;
}
fclose($fp);
echo "
<table cellspacing=0 width=600>
<tr bgcolor=#eaeaea><td height=30><font size=3><b>& 검색결과 -
<a href=\"http://$query\" target=_new>$query</a></b></font></td></tr>
<tr><td><br>
<pre>$result</pre>
</td>
</tr>
</table>
";
}
/* 메세지 출력 */
function print_message ($msg)
{
echo "
<table height=300>
<tr><td align=center><font color=NAVY><b>
$msg
</b></font>
</td>
</tr>
</table>
";
}
?>
<table width=600 align=center>
<tr><td align=center>
<hr size=1 width=100% noshade>
<font size=2><b>PHP WHOIS & (c)Copyright by Oh, Jungjoon</b><br>
<hr size=1 noshade>
</td>
</tr>
</table>
</body>
</html>
소스는 전문을 다 올렸습니다.
해결됐습니디. ^^;
아~ 해결 댔습니다.
php.ini에서 register_globals = Off 값을 On으로 바꿔주니까 되네요.
전역 변수를 사용할수 있게 하는거랍니다. ^^;
에효~ 초보라 하나하나 알아가는 재미가 쏠쏠합니다. :D
" Wanna fly with me ↗ "
댓글 달기