±¹³»IP Á¤º¸ Á¶È¸Çϴ Ŭ·¡½º(php) |
|
|
 |
13³â Àü |
class whoisClass
{
var $ip;
var $pattern = "^[[]+( IP »ç¿ë ±â°ü Á¤º¸ )";
var $result;
//IP¸¦ ÀÔ·ÂÇÏ°í °á°ú°ª(ÇѱÛ) ¹è¿À» ¹ÝȯÇÑ´Ù.
function query_ip($ip){
$this->ip = $ip;
$str = @file(" http://whois.nic.or.kr/whois/webapisvc/?VALUE=". $this->ip);
if(!$str) return false;
$str_num = count($str);
for($i=0 ; $i<$str_num; $i++){
if(eregi("Á¶È¸ÇϽŠIPÁÖ¼ÒÀÇ »ç¿ë±â°ü Á¤º¸´Â ¾Æ·¡¿Í °°½À´Ï´Ù.", $str[$i]) == 1) $Start_Capture = 13;
if($Start_Capture != 0){
switch($Start_Capture){
case 11:
$result = explode("-",ereg_replace("IP ÁÖ¼Ò : ","",$str[$i]));
$this->result["start_ip"] = $result[0];
$this->result["end_ip"] = $result[1];
break;
case 9:
$this->result["isp"] = ereg_replace("¿¬°á ISP¸í : ","",$str[$i]);
break;
case 4:
$this->result["org_id"] = ereg_replace("±â°ü°íÀ¯¹øÈ£ : ","",$str[$i]);
break;
case 3:
$this->result["org_name"] = ereg_replace("±â°ü¸í : ","",$str[$i]);
break;
case 2:
$this->result["city"] = ereg_replace("½Ãµµ¸í : ","",$str[$i]);
break;
case 1:
$this->result["address"] = ereg_replace("ÁÖ¼Ò : ","",$str[$i]);
}
$Start_Capture--;
}
}
return $this->result;
}
}
** ¼³¸í
¹ÝȯµÇ´Â ¹è¿À» $info ¶ó°í ÇÑ´Ù¸é,
$info[start_ip] ÇØ´ç IPÀÇ ´ë¿ªÆø½ÃÀÛIP
$info[end_ip] ÇØ´ç IPÀÇ ´ë¿ªÆø³¡IP
$info[isp] ISP¸í
$info[org_id] ±â°ü°íÀ¯¹øÈ£
$info[org_name] ±â°ü¸í
$info[city] ½Ãµµ¸í
$info[address] ÁÖ¼Ò
|
|
̵̧ : 701 |
̵̧
¸ñ·Ï
|
|