Whois 的PHP代码
类别: PHP教程
这是WHOIS查找的代码。
<?
function whois_request($server, $query) {
$data = "";
$fp = fsockopen($server, 43);
if($fp) {
fputs($fp, $query."rn");
while(!feof($fp)) {
$data .= fread($fp, 1000);
}
fclose($fp);
}
return $data;
}
?>
<FORM>
<INPUT TYPE=HIDDEN NAME=action VALUE=query>
Server: <INPUT TYPE=TEXT NAME=server VALUE="<?echo $server?>"> <SMALL>(ie: whois.networksolutions.com)</SMALL><BR>
Domain: <INPUT TYPE=TEXT NAME=query VALUE="<?echo $query?>"> <SMALL>(ie: wackowoh.com)</SMALL><BR>
<INPUT TYPE=SUBMIT VALUE=" OK ">
</FORM>
<?
if($action == "query") {
$data = whois_request($server, $query);
echo "Sent $query to $server.<p>";
echo "Output: <p><pre>$data</pre><p>";
}
?>
<?
function whois_request($server, $query) {
$data = "";
$fp = fsockopen($server, 43);
if($fp) {
fputs($fp, $query."rn");
while(!feof($fp)) {
$data .= fread($fp, 1000);
}
fclose($fp);
}
return $data;
}
?>
<FORM>
<INPUT TYPE=HIDDEN NAME=action VALUE=query>
Server: <INPUT TYPE=TEXT NAME=server VALUE="<?echo $server?>"> <SMALL>(ie: whois.networksolutions.com)</SMALL><BR>
Domain: <INPUT TYPE=TEXT NAME=query VALUE="<?echo $query?>"> <SMALL>(ie: wackowoh.com)</SMALL><BR>
<INPUT TYPE=SUBMIT VALUE=" OK ">
</FORM>
<?
if($action == "query") {
$data = whois_request($server, $query);
echo "Sent $query to $server.<p>";
echo "Output: <p><pre>$data</pre><p>";
}
?>
- 上一篇: 在 php 中使用 sockets:从新闻组中获取文章
- 下一篇: PHP 数据加密
-= 资 源 教 程 =-
文 章 搜 索