获取附近停车场列表示例代码[PHP]

作者: 阅读数:841 上传时间:2019-07-15

获取附近停车场列表

  <?php
//获取附近停车场列表
require_once 'curl.func.php';

$appkey = 'your_appkey_here';//你的appkey
$lat = '30.2812129803';
$lng = '120.11523398';
$distance = '1000';
$url = "https://api.jisuepc.com/parking/nearby?appkey=$appkey&lat=$lat&lng=$lng&distance=$distance";
$result = curlOpen($url, ['ssl'=>true]);
$jsonarr = json_decode($result, true);

if($jsonarr['status'] != 0)
{
    echo $jsonarr['msg'];
    exit();
}
$result = $jsonarr['result'];
echo $result['totalCount'].' ';
foreach($result['list'] as $val)
{
     echo $val['pid'].' '.$val['name'].' '.$val['type'].' '.$val['province'].' '.$val['city'].' '.$val['area'].' '.$val['address'].' '.$val['lat'].' '.$val['lng'].' '.$val['num'].' '.$val['leftnum'].' '.$val['price'].' '.$val['priceuit'].' '.$val['pricedesc'].' '.$val['canbook'].' '.$val['bookprice'].' '.$val['piclist'].'
'; }
×