基站雲介面開發執行個體(PHP調用基站資料介面)

來源:互聯網
上載者:User

標籤:blog   http   io   os   ar   資料   div   on   c   

基站雲平台介面調用執行個體,採用CURL快速存取基站雲平台的基站資料介面,擷取基站資料,並通過JSON解析成數組資料。

<?php/*基站雲介面調用執行個體QQ:742631333*/header("Content-type:text/html;charset=utf-8"); //UTF8編碼$apikey=""; //設定APIKEY$mnc=0;    //0移動 1聯通$lac=2;    //大區號$cell=2;   //小區號$apiurl="http://www.jizhanyun.com/api/?mnc=$mnc&lac=$lac&cell=$cell&ishex=0&apikey={$apikey}";$data=curl_file_get_contents($apiurl);$json=json_decode($data);$code=$json->code;      //狀態編號$about=$json->about;      //狀態原因if($code==‘001‘){$data=$json->data[0];    //資料集$lng=$data->lng;         //緯度$lat=$data->lat;         //經度$glng=$data->glng;       //Google緯度$glat=$data->glat;       //Google經度$address=$data->address; //地址描述//輸出結果echo "<b>基站雲定位結果:</b><br/>";echo "緯度:".$lng."<br/>";echo "經度:".$lat."<br/>";echo "Google緯度:".$glng."<br/>";echo "Google經度:".$glat."<br/>";echo "地址描述:".$address."<br/>";}else{echo "返回結果:".$about;}//HTTP請求函數function curl_file_get_contents($durl){   $ch = curl_init();   curl_setopt($ch, CURLOPT_URL, $durl);   curl_setopt($ch, CURLOPT_TIMEOUT, 10);   curl_setopt($ch, CURLOPT_USERAGENT, _USERAGENT_);   curl_setopt($ch, CURLOPT_REFERER,_REFERER_);   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);   $r = curl_exec($ch);   curl_close($ch);   return $r; } ?>

  

基站雲介面開發執行個體(PHP調用基站資料介面)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.