手机
当前位置:查字典教程网 >编程开发 >php教程 >PHP实现手机归属地查询API接口实现代码
PHP实现手机归属地查询API接口实现代码
摘要:复制代码代码如下:

复制代码 代码如下:

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

}

}

?>

<form action=”mobile.php” method=”get”>

手机号码: <input type=”text” name=”number” /> <input type=”submit” value=”提交” />

</form>

【PHP实现手机归属地查询API接口实现代码】相关文章:

PHP自动生成月历代码

PHP通过API获取手机号码归属地

PHP中实现进程间通讯

论坛头像随机变换代码

PHP数据库开发知多少

PHP实现过滤掉非汉字字符只保留中文字符

PHP时间和日期函数详解

PHP中的traits实现代码复用使用实例

PHP中预定义的6种接口介绍

PHP教程:清除wordpress里恶意代码

精品推荐
分类导航