当前位置: 首页 > 图文教程 > 网络编程 > PHP > PHP IPwhois类

PHP
我的论坛源代码(三)
我的论坛源代码(二)
杏林同学录(七)
杏林同学录(八)
我的论坛源代码(十)
我的论坛源代码(九)
杏林同学录(九)
支持oicq头像的留言簿(二)
支持oicq头像的留言簿(一)
一个简单实现多条件查询的例子
不用数据库的多用户文件自由上传投票系统(1)
模仿OSO的论坛(二)
簡繁体转换的class
从C/C++迁移到PHP:判断字符类型的函数
PHP编程之高级技巧:利用Mysql函数
让你同时上传 1000 个文件 (二)
一个好用的分页函数
php环境配置 php5 mysql5 apache2 phpmyadmin安装与配置
PHP编程中八种常见的文件操作方式
给初学PHP的5个入手程序

PHP IPwhois类


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 73 ::
收藏到网摘: n/a

 

原来写的IPwhois类

 <?php
/*
*
* Class : IP Whois Verson 1.0
* Info : Get IP's information form 4 whois server
* Author : PhpUp Studio
* Date : 12/12/2004
* www.knowsky.com
*
*/
class IPWhois
{
        var $server = 'whois.arin.net';
        var $target;
        var $timeout = 10;
        var $msg;
       
        function IPWhois($target)
        {
                $this->target = $target;       
        }
        function ShowInfo()
        {
                if($this->_CheckIP($this->target))
                {
                        $this->msg = $this->_GetInfo($this->server);
                        if($this->_CheckInfo($this->msg))
                        {
                                $this->msg = $this->_GetInfo($this->server);
                        }
                }
                else $this->msg = '<p>Please Enter An IP Address<br></p>';
               
                return $this->msg;       
        }
        function _CheckIP($temptarget)
        {
                if(eregi("[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}", $temptarget))
                {
                        $f = 1;
                        $detail = explode(".",$temptarget);
                        foreach($detail as $v)
                        {
                                if($v > 255 || $v < 0)
                      &nbs