PHP 手机归属地查询 api
PHP 手机归属地查询 api
发布时间:2016-12-29 来源:查字典编辑
摘要:复制代码代码如下:手机号:

复制代码 代码如下:

<?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教程学习
热门php教程学习
编程开发子分类