首页 车型保养套餐查询 车型保养套餐查询示例代码 获取保养产品[PHP]

获取保养产品示例代码[PHP]

作者: 阅读数:1583 上传时间:2021-09-02

获取保养产品

<?php

require_once 'curl.func.php';

$appkey = 'your_appkey_here';//你的appkey
$classid = '65';
$vin = '';
$brandid = '';
$carid = '21617';
$url = "https://api.jisuapi.com/maintenance/product?appkey=$appkey&classid=$classid&vin=$vin&brandid=$brandid&carid=$carid";
$result = curlOpen($url, ['ssl'=>true]);

$jsonarr = json_decode($result, true);
//exit(var_dump($jsonarr));

if($jsonarr['status'] != 0)
{
    echo $jsonarr['msg'];
    exit();
}

$result = $jsonarr['result'];
echo $result['vin'].' '.$result['brandid'].' '.$result['classid'];
foreach($result['partslist'] as $key=>$val)
{
	echo $val['partsid'].' '.$val['name'].' '.$val['number'].' '.$val['price'].' '.$val['remark'].' '.$val['marketprice'];
}
foreach($result['list'] as $key=>$val)
{
	echo $val['name'].' '.$val['number'].' '.$val['brand'].' '.$val['price'].' '.$val['classid'].' '.$val['brandid'];
}