菜单 学习猿地 - LMONKEY

VIP

开通学习猿地VIP

尊享10项VIP特权 持续新增

知识通关挑战

打卡带练!告别无效练习

接私单赚外块

VIP优先接,累计金额超百万

学习猿地私房课免费学

大厂实战课仅对VIP开放

你的一对一导师

每月可免费咨询大牛30次

领取更多软件工程师实用特权

入驻
343
0

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

原创
05/13 14:22
阅读数 72374

<?php
header(“Content-Type:text/html;charset=utf-8″);
if (isset($_GET['number'])) {
$url = ‘http://webservicwww.cppcns.come.webxml.com.cn/WebServices/MobileCodeWS.asmx/getMobileCodeInfo';
$number = $_GET['number'];
$ch = curl_http://www.cppcns.cominit();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, “mobileCode={$number}&userId=”);
curl_setopt($ch, CUR编程客栈LOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
curl_cNDAonHsXclose($ch);
$data = simplexml_load_string($data编程客栈);
if (strpos($data, ‘http://')) {
echo ‘手机号码格式错误!';
} else {
echo $data;
}
}
?>
<form action=”mobile.php” method=”get”>
手机号码: <input type=”text” name=”number” /> <input type=”submit” value=”提交” />
</form>
本文标题: PHP实现手机归属地查询API接口实现代码
本文地址: http://www.cppcns.com/wangluo/php/88862.html

发表评论

0/200
343 点赞
0 评论
收藏
为你推荐 换一批