whois 도메인 검색이 안됩니다.

dewytear의 이미지

다음과 같은 소스를 얻어서 서버에 올리고 검색을 해보고있습니다.
소스는 제가 산 책에 있는 예제 입니다.
검색할 도메인을 적고 검색을 눌러도 도무지 검색이 안됩니다.
왜그런 건가요 ?

<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>

소스는 전문을 다 올렸습니다.

dewytear의 이미지

아~ 해결 댔습니다.

php.ini에서 register_globals = Off 값을 On으로 바꿔주니까 되네요.
전역 변수를 사용할수 있게 하는거랍니다. ^^;
에효~ 초보라 하나하나 알아가는 재미가 쏠쏠합니다. :D

" Wanna fly with me ↗ "

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.