PHP code example of liv / baidu-lbs
1. Go to this page and download the library: Download liv/baidu-lbs 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/ */
liv / baidu-lbs example snippets
$console = new Console();
$console->setServerAK('KbMeaL3jz0ds1lbG11g3Esys', 'myGUcGyxhZvVOtINr8wrvkbGIxTb9CSG');
$geoTableId = '116200';
$search = new NearbySearch($geoTableId, $console, '120.734879,31.288689', 100);
$nearby = $search->search();
var_dump($nearby);
$search = new LocalSearch($geoTableId, $console, 1);
$search->setSortBy('ClickCount', BasicSearch::DESCEND);
$search->addFilter('ClickCount', 1, 100);
$search->addTags('华北');
$local = $search->search();
var_dump($local);
$search = new BoundSearch($geoTableId, $console, '116.383801,39.90112', '116.412475,39.916451');
$bound = $search->search();
$search = new DetailSearch($geoTableId, $console, 18460245);
$detail = $search->search();
var_dump($detail);
$console = new Console();
$console->setServerAK('KbMeaL3jz0ds1lbG11g3Esys', 'myGUcGyxhZvVOtINr8wrvkbGIxTb9CSG');
$geoTableId = '116200';
$search = new NearbySearch($geoTableId, $console, '120.734879,31.288689', 100);
$nearby = $search->search();
var_dump($nearby);
$search = new LocalSearch($geoTableId, $console, 1);
$search->setSortBy('ClickCount', BasicSearch::DESCEND);
$search->addFilter('ClickCount', 1, 100);
$search->addTags('华北');
$local = $search->search();
var_dump($local);
$search = new BoundSearch($geoTableId, $console, '116.383801,39.90112', '116.412475,39.916451');
$bound = $search->search();
$search = new DetailSearch($geoTableId, $console, 18460245);
$detail = $search->search();
var_dump($detail);