Home > Backend Development > PHP Tutorial > php获取手机归属地.你们用的是什么步骤

php获取手机归属地.你们用的是什么步骤

WBOY
Release: 2016-06-13 13:19:25
Original
883 people have browsed it

php获取手机归属地....你们用的是什么方法
网上只找到了下面的这个api...但试了一下...好像已经不能用了..现在你们都用什么方法来获取手机归属地等信息啊.....尽量不要下载号码段包

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
<?php header("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;
}
}
?>

Copy after login
手机号:


------解决方案--------------------


改为




一切就OK了
------解决方案--------------------
我不知道你用的是什么编辑器,没法回答你。这样吧,你用记事本打开那个PHP文件,然后选择“另存为”,出现一个保存界面,在编码那一栏里面选择UTF-8,点击确定就行了。
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template