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 _...