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

PHP
php教程:mysql数据库操作的DB类
PHP教程:cookie和数组的结合实现购物车
php教程:mysql的常用语句
php教程:经典PHP代码
php编程中遇到的cookie的问题
php入门交流:鼓励学习PHP的新手
细数PHP程序的一些缺陷
说明PHP开发网站程序的优点
PHP+MYSQL网站开发中遇到的问题汇总
php教程:php设计模式介绍之工厂模式
ubuntu下apache2不能解释php程序故障
WIN2003+IIS6+PHP5根目录无法运行PHP程序
PHP+MYSQL网站开发中关于时间的问题
PHP正则表达式提取超链接及其标题
PHP中的Date()函数详细讲解
初学:apache与php基本配置
PHP串行化与JSON
php教程:php设计模式介绍之单条模式
PHP中不能使用exec(),system(),shell_system()等函数
PHP正则表达式从url中取得域名

PHP IPwhois类


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