Home > Backend Development > PHP Tutorial > IP reverse domain name PHP source code_PHP tutorial

IP reverse domain name PHP source code_PHP tutorial

WBOY
Release: 2016-07-13 17:48:23
Original
1525 people have browsed it

IP reverse query domain name. Nowadays, the IP query function of Bing is generally used, that is, IP:222.222.222.222

Written as php code it becomes


// Call method
$result=getResult("124.205.228.114");
print_r($result);

function getContent($url){
$content=file_get_contents($url);
Return $content;
}

function getResult($ip){
$pagesize=10;
$page=1;
$url="http://cn.bing.com/search?q=ip%3A$ip&first=$page";
$result=array();
do

         $url="http://cn.bing.com/search?q=ip%3A$ip&first=$page"; 
          $content=getContent($url);                                                    $pattern="/([a-zA-Z0-9.]*)(?:/.*)?/isU";
Preg_match_all($pattern, $content, $matches);
         $result=array_merge($result,$matches[1]);
         $nextpage=strpos($content, "Next page");
         $page=$page+$pagesize;                                 }while($nextpage);
         
$result=array_values(array_unique($result));
         
Return $result;
}

?>

// Call method
$result=getResult("124.205.228.114");
print_r($result);

function getContent($url){
         $content=file_get_contents($url);
        return $content;
}

function getResult($ip){
        $pagesize=10;
        $page=1;
         $url="http://cn.bing.com/search?q=ip%3A$ip&first=$page";
         $result=array();
        do
          {
                 $url="http://cn.bing.com/search?q=ip%3A$ip&first=$page";
                 $content=getContent($url);
$pattern="/([a-zA-Z0-9.]*)(?:/.*)?/isU";
                   preg_match_all($pattern, $content, $matches);
                   $result=array_merge($result,$matches[1]);
                 $nextpage=strpos($content, "Next page");
$page=$page+$pagesize;
}while($nextpage);
         
         $result=array_values(array_unique($result));
         
        return $result;
}

?>


Excerpted from gaohui blog


http://www.bkjia.com/PHPjc/478440.html

truehttp: //www.bkjia.com/PHPjc/478440.htmlTechArticleIP reverse query domain name. Nowadays, an IP query function of bing is generally used, that is, IP:222.222.222.222 is written as The php code becomes?php // Call method $result=getResult(124.205.228.114); print_...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template