PHP source code for reverse IP lookup domain name _ PHP Tutorial

Source: Internet
Author: User
IP lookup domain name PHP source code. IP lookup domain names, usually bing's IP query function is used now, that is, IP: 222.222.222.222 is written as php code? Php call method $ resultgetResult (124.205.228.114); print _ IP lookup domain name, usually using an IP address query function of bing, that is, IP address: 222.222.222.222

Writing php code 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 \.] *) (? :\/.*)? <\/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;
}

?>

// 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 \.] *) (? :\/.*)? <\/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

Why is the php code written in ghost? Php // call the method $ result = getResult (124.205.228.114); print _...

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.