Base Station cloud Platform interface call instance, using curl to quickly access the base station cloud platform data interface, to obtain the base station data, and through JSON to parse the array data.
<?php/* Base Station Cloud Interface Call Instance Qq:742631333*/header ("Content-type:text/html;charset=utf-8"); UTF8 code $apikey= ""; Set apikey$mnc=0; 0 Mobile 1 Unicom $lac=2; Large area code $cell=2; Cell number $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; Status number $about= $json->about; Status description if ($code = = ' 001 ') {$data = $json->data[0]; Data set $lng= $data->lng; Latitude $lat= $data->lat; Longitude $glng= $data->glng; Google Latitude $glat= $data->glat; Google Longitude $address= $data->address; Address description//output echo "<b> Base Station cloud location result:</b><br/>"; echo "Latitude:". $lng. " <br/> "; echo" Longitude: ". $lat." <br/> "; echo" Google Latitude: ". $glng." <br/> "; echo" Google Longitude: ". $glat." <br/> "; echo" Address Description: ". $address." <br/> ";} Else{echo "return Result:". $about;} HTTP request functions 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; }?>
Base Station Cloud Interface Development Example (PHP call base Station Data interface)