whois 域名查询系统

<?php

/*
 * 域名查询系统:扒万网的
 *	post 方式比较快。。。万网主页使用的
 * 	get 方式不稳定.....
 * */

//!empty($_GET['domain']) && whois(trim($_GET['domain']));
if(empty($_GET['domain']))
	outJsonpStream(array("statu"=>0),false);
	
	
$data = array  
(  
    'domain' => trim($_GET['domain'])
);
  
$data= postWhois('http://pandavip.www.net.cn/check/check_ac1.cgi', $data); 
$_ar=explode("|", $data);
/*
 * return 211 有注册
 * 			210 无注册
 * */
outJsonpStream(array("statu"=>$_ar[2]),false);

function getWhois($domain)
{
    //http://whois.hichina.com/        
    //$cha = 'http://whois.hichina.com/whois/domain/'.$domain;
    //$cha='http://whois.hichina.com/whois/api_webinfo?host='.$domain ; //找到公司注册信息

    $cha='http://whois.hichina.com/whois/api_webinfo?host='.$domain ;    

    $fp=  file_get_contents($cha,'rb');
    outJsonpStream($fp);
}

function postWhois($url, $post = null)  
{  
    $context = array();  
  
    if (is_array($post))  
    {  
        ksort($post);  
  
        $context['http'] = array  
        (  
            'method' => 'POST',  
            'content' => http_build_query($post, '', '&'),  
        );  
    }
  
    return  file_get_contents($url, false, stream_context_create($context)); 
    //outJsonpStream($fp); 
}  

function outJsonpStream($data,$isJson=true)
{
	$callback = $_REQUEST['callback'];
	if ($callback) {
	    header('Content-Type: text/javascript');
	    $json=!$isJson?$callback . '(' . json_encode($data) . ');': $callback . '(' .$data . ');';	    
	} else {
	    //header('Content-Type: application/x-json');
	    $json=!$isJson?json_encode($data):$data;	
	}
	echo $json;
	exit;
}
?>

  

whois 域名查询系统

编写:solq
blog:cnblogs.com/solq

posted @ 2012-05-25 10:49  solq  阅读(1568)  评论(0编辑  收藏  举报