+ -
当前位置:首页 → 问答吧 → 手机号归属地查询

手机号归属地查询

时间:2010-01-31

来源:互联网

演示地址: http://www.phpfamily.cn/WebServices/mobile.php
复制代码
  1. <?php
  2. header("Content-Type:text/html;charset=utf-8");
  3. if (isset($_GET['number'])) {
  4.     $url    = 'http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx/getMobileCodeInfo';
  5.     $number = $_GET['number'];
  6.     $ch     = curl_init();
  7.     curl_setopt($ch, CURLOPT_URL, $url);
  8.     curl_setopt($ch, CURLOPT_POST, true);
  9.     curl_setopt($ch, CURLOPT_POSTFIELDS, "mobileCode={$number}&userId=");
  10.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  11.     $data = curl_exec($ch);
  12.     curl_close($ch);
  13.     $data = simplexml_load_string($data);
  14.     if (strpos($data, 'http://')) {
  15.         echo '手机号码格式错误!';
  16.     } else {
  17.         echo $data;
  18.     }
  19. }
  20. ?>
  21. <form action="mobile.php" method="get">
  22. 手机号: <input type="text" name="number" />   <input type="submit" value="提交" />
  23. </form>

作者: xiaokai   发布时间: 2010-01-31

你这个东东不错
关于这个API的背景能详细介绍一下吗?

作者: mofe   发布时间: 2010-01-31

抱歉。打不开

作者: mofe   发布时间: 2010-01-31

膜拜楼主

作者: cain   发布时间: 2010-02-01

相关阅读 更多

热门下载

更多