PHP code example of jialeo / baidu-lbsyun

1. Go to this page and download the library: Download jialeo/baidu-lbsyun library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jialeo / baidu-lbsyun example snippets


$ak = 'your-ak';
$sk = 'your-sk';

$baidu = new \JiaLeo\Baidu\LBSYun\WebApi($ak, $sk);

//geoconv  坐标转换
$result = $baidu->geoconv(1, 5, '113.35025277778,23.254811111111');

//逆地理编码
$result1 = $baidu->geocoder($result['result'][0]['y'] . ',' . $result['result'][0]['x']);

var_dump($result, $result1);