首页 车型大全 车型大全示例代码 车型搜索[PHP]

车型搜索示例代码[PHP]

作者: 阅读数:1927 上传时间:

车型搜索

<?php

require_once 'curl.func.php';

$appkey = 'your_appkey_here';//你的appkey
$keyword = '奔驰E级2017款E200运动版';//车ID
$url = "https://api.jisuapi.com/car/search?keyword=$keyword&appkey=$appkey";
$result = curlOpen($url, ['ssl'=>true]);
$jsonarr = json_decode($result, true);
//exit(var_dump($jsonarr));
if($jsonarr['status'] != 0)
{
    echo $jsonarr['msg'];
    exit();
}
echo $result['keyword'].':';
$result = $jsonarr['result']['list'];
foreach($result as $v)
{
    echo $v['id'].' '.$v['name'].' '.$v['logo'].' '.$v['salestate'].' '.$v['price'].' '.$v['yeartype'].' '.$v['productionstate'].' '.$v['sizetype'].'
';//具体的每一款车,4级 }