PHP 手机归属地查询 api

前端之家收集整理的这篇文章主要介绍了PHP 手机归属地查询 api前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

<div class="codetitle"><a style="CURSOR: pointer" data="28104" class="copybut" id="copybut28104" onclick="doCopy('code28104')"> 代码如下:

<div class="codebody" id="code28104">
<?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">
手机号:

猜你在找的PHP相关文章