//百度地理位置接口API
$lat = 39.912108791024;
$lng = 116.48299016095;
$ak = "5slgyqGDENN7Sy7pw29IUvrZ"; //秘钥,需要申请,百度为了防止频繁请求
$locationURL = "http://api.map.baidu.com/geocoder/v2/?callback=renderReverse&location=$lat,$lng&output=json&pois=1&ak=$ak";
$ch = curl_init($locationURL) ;
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // 获取数据返回
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); // 在启用 CURLOPT_RETURNTRANSFER 时候将获取数据返回
$result = curl_exec($ch);
echo $result;

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-11
  • 2022-12-23
  • 2022-01-13
  • 2022-01-04
猜你喜欢
  • 2021-05-19
  • 2021-05-27
  • 2021-10-18
  • 2021-08-02
  • 2021-09-28
  • 2022-12-23
相关资源
相似解决方案