PHP 手机归属地查询 api
更新时间:2010年02月08日 09:56:33 作者:
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>
相关文章
Zend Framework入门教程之Zend_Config组件用法详解
这篇文章主要介绍了Zend Framework入门教程之Zend_Config组件用法,结合实例形式分析了Zend_Config组件针对各种类型配置文件操作的相关技巧,需要的朋友可以参考下2016-12-12深入php函数file_get_contents超时处理的方法详解
本篇文章是对php函数file_get_contents超时处理的方法进行了详细的分析介绍,需要的朋友参考下2013-06-06
最新评论