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

PHP
PHP删除MYSQL数据库中所有表的代码
php教程:php设计模式介绍之注册模式
php教程:php设计模式介绍之伪对象模式
PHPnow轻松打造专业PHP服务器环境
php教程:php设计模式介绍之策略模式
php教程:php设计模式介绍之迭代器模式
Windows环境下Apache与Tomcat共存
简单学习php遇到的主要问题
php教程:php设计模式介绍之观测模式
php教程:php设计模式介绍之规范模式
php教程:php设计模式介绍之代理模式
php教程:php设计模式介绍之装饰器模式
Perl操作mysql数据库的方法
php教程:php设计模式介绍之适配器模式
PHP单件模式和命令链模式的基础知识
PHP大师指点:优秀的PHP代码怎么来?
PHP开发的Myers 订单跟踪系统 (MOTS)
PHP控制网页过期时间的程序
Cannot modify header information出错的原因
PHP 5.3的date_create_from_format()函数

PHP IPwhois类


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 83 ::
收藏到网摘: 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