The result obtained by an IP address is not perfect. The reason is that the IP Address Resolution of ip138 is not very detailed in dealing with foreign addresses, So I re-wrote a code using Chianz.com.
<! DOCTYPE html>
<Html lang = "en">
<Head>
<Title> </title>
<Meta charset = "UTF-8"/>
<Meta name = "author" content = ""/>
<Meta name = "keywords" content = ""/>
<Meta name = "description" content = ""/>
</Head>
<Body>
<? Php tutorial
$ IpAddr = "4.4.44.4 ";
$ IpChinazAddr = "http://tool.chinaz.com/IP? IP = ". $ ipAddr;
$ Contents = file_get_contents ($ ipChinazAddr );
$ Pattern = "/==>>. + </strong> <br/> /";
$ String = $ contents;
Preg_match_all ($ pattern, $ string, $ addrArray );
$ Num = count ($ addrArray [0]);
$ Pattern = "/(==>>). + (==>> s )/";
For ($ I = 0; $ I <$ num; $ I ++ ){
$ AddrArray [0] [$ I] = preg_replace ($ pattern, "", $ addrArray [0] [$ I]);
}
Echo "<pre> ";
Print_r ($ addrArray );
Echo "</pre> ";
?>
</Body>
</Html>