PHP通過API擷取手機號碼歸屬地_php執行個體

來源:互聯網
上載者:User
該API介面自 2011年 SAE平台上線穩定運行至今,增加了17號段的支援,歡迎各種採集注限制 並發10

詳細使用說明

介面地址:http://appyun.sinaapp.com/index.php?app=mobile&controller=index&action=api

要求方法:GET

請求參數:

參數名 類型 必填 參數位置 描述 預設值
app string 是 urlParam 模組名稱(不變) mobile
controller string 是 urlParam 控制器名稱 index
action string 是 urlParam 操作名稱 api
mobile string 是 urlParam 手機號碼或號段 13800138000
outfmt string 是 urlParam 期望得到的結果類型 json
請求樣本:

http://appyun.sinaapp.com/index.php?app=mobile&controller=index&action=api&outfmt=json&mobile=13800138000

JSON返回樣本:

{  "id":"80012",   "Mobile":"13800138000",   "Province":"\u5317\u4eac",   "City":"\u5317\u4eac",   "AreaCode":"010",   "PostCode":"100000",   "Operators":"\u4e2d\u56fd\u79fb\u52a8",   "Card":"GSM"}

XML返回樣本:

<?xml version="1.0" encoding="utf-8" ?>  13800138000   True  北京  北京  010  100000  中國移動  GSM

使用方法

function getMobileInfo($mobile)  {   $response = file_get_contents('http://appyun.sinaapp.com/index.php?app=mobile&controller=index&action=api&outfmt=json&mobile='.$mobile)    $result = json_decode($response,true);    return $result;}

以上所述就是本文的全部內容了,希望大家能夠喜歡。

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.