【发布时间】:2017-12-02 01:42:39
【问题描述】:
我的控制器上有以下 Guzzle 发送请求:-
$client = new GuzzleHttp\Client(['base_uri' => 'https://domainname/api/v1/']);
$response = $client->request('POST', 'user/register', [
'headers' => [
'Authorization' => Session::get('token'),
'Content-Type' => 'application/x-www-form-urlencoded'
]],
[ 'form_params' => [
'user_id' => $user->id,
'start_date' => $start_date,
'expiry_date' => $expiry_date
],
]);
$response= $response->getBody();
上述语法只发送标头,但是,我应该使用什么正确的语法来发送标头和正文。
【问题讨论】:
-
您是否查看过该
request方法的 guzzle 文档?
标签: php laravel http http-post guzzle