IP Lookup domain name PHP source code

Source: Internet
Author: User
Tags domain name lookup

Domain Name Lookup by IP address, which is usually an IP address query function of bing, that is, IP Address: 222.222.222.222
 
Writing php code becomes
 
<? Php
 
// 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 = "/<cite> ([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;
}
 
?>
<? Php
 
// 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 = "/<cite> ([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;
}
 
?>
 
 
From gaohui blog

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.