PHP实现手机归属地查询API接口实现代码_PHP教程

原创
2016-07-21 15:16:32 644浏览

复制代码 代码如下:

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;
}
}
?>

手机号码:

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/325909.htmlTechArticle复制代码 代码如下: ?php header(“Content-Type:text/html;charset=utf-8″); if (isset($_GET['number'])) { $url = ‘http://webservice.webxml.com.cn/WebServices/MobileCodeWS...
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。