The result of obtaining an IP is not very perfect. The reason is that the IP resolution of ip138 is not very detailed when dealing with foreign addresses, so I re-wrote the code using Chianz.com.
$ipAddr = "4.4.44.4 ";
$ipChinazAddr = "http://tool.chinaz.com/IP/?IP=".$ipAddr;
$contents = file_get_contents($ipChinazAddr);
$pattern = "/= =>>.+
/";
$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 ""; <br>print_r($addrArray); <br>echo "";
?>