本代码是基于聚合数据的移动联通基站查询API实现的基站定位功能
<?php // +---------------------------------------------------------------------- // | JuhePHP [ NO ZUO NO DIE ] // +---------------------------------------------------------------------- // | Copyright (c) 2010-2015 http://juhe.cn All rights reserved. // +---------------------------------------------------------------------- // | Author: Juhedata <info@juhe.cn> // +---------------------------------------------------------------------- //---------------------------------- // 聚合数据-基站查询API调用示例代码 //---------------------------------- header('Content-type:text/html;charset=utf-8'); $apiurl = 'http://v.juhe.cn/cell/get'; //基站接口url $mnc = '0';//移动基站:0 联通基站:1 默认:0 $cell = '28655';//大区号 $lac = '17695';//小区号 $key = '52a0ee009932b35054********'; //您申请的appkey $params = "mnc={$mnc}&cell={$cell}&lac={$lac}&key={$key}"; $content = juhecurl($apiurl,$params); if(!$content){ echo "网络错误,请求接口失败"; }else{ $result = json_decode($content,true); $error_code = $result['error_code']; if($error_code == 0){ //成功请求到数据 $data = $result['result']['data'][0]; /* "MCC":"460", "MNC":"1", "LNG":"120.721423", //gps坐标:经度 "LAT":"31.29854", //gps坐标:纬度 "O_LNG":"120.72577772352", //高德坐标:经度 "O_LAT":"31.296529947917", //高德坐标:纬度 "PRECISION":"1101", //基站覆盖半径 "ADDRESS":"江苏省苏州市吴中区金鸡湖大道368号" //基站地址 */ print_r($data); }else{ echo $result['reason']."(".$result['error_code'].")"; } } function juhecurl($url,$params=false,$ispost=0){ $httpInfo = array(); $ch = curl_init(); curl_setopt( $ch, CURLOPT_HTTP_VERSION , CURL_HTTP_VERSION_1_1 ); curl_setopt( $ch, CURLOPT_USERAGENT , 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36' ); curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT , 30 ); curl_setopt( $ch, CURLOPT_TIMEOUT , 30); curl_setopt( $ch, CURLOPT_RETURNTRANSFER , true ); if( $ispost ) { curl_setopt( $ch , CURLOPT_POST , true ); curl_setopt( $ch , CURLOPT_POSTFIELDS , $params ); curl_setopt( $ch , CURLOPT_URL , $url ); } else { if($params){ curl_setopt( $ch , CURLOPT_URL , $url.'?'.$params ); }else{ curl_setopt( $ch , CURLOPT_URL , $url); } } $response = curl_exec( $ch ); if ($response === FALSE) { //echo "cURL Error: " . curl_error($ch); return false; } $httpCode = curl_getinfo( $ch , CURLINFO_HTTP_CODE ); $httpInfo = array_merge( $httpInfo , curl_getinfo( $ch ) ); curl_close( $ch ); return $response; }

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)