Heim >Backend-Entwicklung >PHP-Tutorial >php获取手机归属地.你们用的是什么步骤
php获取手机归属地....你们用的是什么方法
网上只找到了下面的这个api...但试了一下...好像已经不能用了..现在你们都用什么方法来获取手机归属地等信息啊.....尽量不要下载号码段包
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?phpheader ("Content-Type:text/html;charset=utf-8");if (isset($_GET['number'])) {$url = 'http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx/getMobileCodeInfo';$number = $_GET['number'];$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_POST, true);curl_setopt($ch, CURLOPT_POSTFIELDS, "mobileCode={$number}&userId=");curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);$data = curl_exec($ch);curl_close($ch);$data = simplexml_load_string($data);if (strpos($data, 'http://')) {echo '手机号码格式错误!';} else {echo $data;}}?>