<?php $ip = "218.192.3.42"; $json = file_get_contents("http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=json&ip=".$ip); $json = json_decode($json, true); echo "IP地址:".$ip; echo "归属地:".$json["country"].$json["province"].$json["city"].$json["district"].$json["isp"]; ?>