【发布时间】:2020-01-05 18:56:48
【问题描述】:
我的解决方案很简单,但老实说花了将近 5 个小时,仍然没有找到我的答案。
我需要使用Post 发送请求并检索我的数据。
使用 POSTMAN 就可以了。
这里是我的代码
use GuzzleHttp\Client;
$client =new Client();
$client->post($url,[
'form_params' => [
'{}'
]
]);
使用POSTMAN,我不需要设置Header,我只需要发送{}。
得到这个错误:
Client error: `POST http://URL` resulted in a `400
Bad Request` response: {"error":"Failed when parsing body as json"}
那么,我现在该怎么做呢?
【问题讨论】:
标签: php json laravel post guzzle