guzzle json 请求
use GuzzleHttp\Client;
$guzzle = new Client();
$header = [
'Content-Type' => 'application/json',
'appKey'=> $app_key,
'timestamp' => $timestamp,
'sign' => $sign
];
$data = [
'orderNo' => $ccic_order['third_order_no'],
'voucherNo' => $ccic_order['voucher_no'],
'userNo' => $ccic_order['ecif_id'],
'productCode' => $ccic_order['service_id'],
'orderType' => 1,
'orderStatus' => 3, // 0:未使用,自费券购买后默认状态 1:使用中 2:使用完成 3:取消
'ownExpense' => 1,
'callbackType' => 2,
];
$response = $guzzle->post($callback_url, [
'headers' => $header, 'json' => $data
]);
$res = json_decode($response->getBody()->getContents(),true);
\Seaslog::info("请求结果:" . json_encode($res, JSON_UNESCAPED_UNICODE));
guzzle官方文档传送门:https://guzzle-cn.readthedocs.io/zh_CN/latest/
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步