Home  >  Article  >  php教程  >  新浪通过IP地址获取当前地理位置(省份,城市等)的接口

新浪通过IP地址获取当前地理位置(省份,城市等)的接口

WBOY
WBOYOriginal
2016-06-06 19:37:271595browse

新浪通过IP地址获取当前地理位置(省份,城市等)的接口 无 function getIpAddress(){ $ipContent = file_get_contents("http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js"); $jsonData = explode("=",$ipContent); $jsonAddress = substr($json

新浪通过IP地址获取当前地理位置(省份,城市等)的接口 
	function getIpAddress(){  
		$ipContent   = file_get_contents("http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js");  
		$jsonData = explode("=",$ipContent);    
		$jsonAddress = substr($jsonData[1], 0, -1);  
		return $jsonAddress;  
	}  
	$ip_info=json_decode(getIpAddress());	
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn