IP reverse Domain name PHP source _php Tutorial

Source: Internet
Author: User
IP Reverse Lookup domain name, now used is generally Bing's an IP query function, that is ip:222.222.222.222

The PHP code becomes


Calling methods
$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\.] *)(?:\ /.*)? <\/cite>/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;
}

?>

Calling methods
$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\.] *)(?:\ /.*)? <\/cite>/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;
}

?


Excerpt from Gaohui blog

http:// www.bkjia.com/PHPjc/478440.html www.bkjia.com true http:// www.bkjia.com/PHPjc/478440.html techarticle IP reverse lookup domain name, now with the general Bing is an IP query function, that is, ip:222.222.222.222 written PHP code becomes?" PHP//Call method $result =getresult ( 124.205.228.114); Print_.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.