尝试用 guzzle 更新数据
Trying to update data with guzzle
我正在使用 Guzzle,我需要更新数据,因此我正在尝试以下操作:
$request = $this->guzzleClient->put($this->url, [
'headers' => $this->dcsheaders,
'json' => json_encode([
"status" => "Open",
"accountNumber"=> "01236548",
"reasonId"=>"ccaa8e8d-70ae-466d-b8c8-dd16bc5454e0"
])
]);
$a = $request->send();
var_dump($a);
但是我收到了
resulted in a 400 Bad Request
response
我尝试了其他类型,例如 form_params,但我收到 403
The json option is used to easily upload JSON encoded data as the body of a request.
来源: json request option guzzle
改成这个
$request = $this->guzzleClient->put($this->url, [
'headers' => $this->dcsheaders,
'json' => [
"status" => "Open",
"accountNumber"=> "01236548",
"reasonId"=>"ccaa8e8d-70ae-466d-b8c8-dd16bc5454e0"
]
]);
我正在使用 Guzzle,我需要更新数据,因此我正在尝试以下操作:
$request = $this->guzzleClient->put($this->url, [
'headers' => $this->dcsheaders,
'json' => json_encode([
"status" => "Open",
"accountNumber"=> "01236548",
"reasonId"=>"ccaa8e8d-70ae-466d-b8c8-dd16bc5454e0"
])
]);
$a = $request->send();
var_dump($a);
但是我收到了
resulted in a
400 Bad Request
response
我尝试了其他类型,例如 form_params,但我收到 403
The json option is used to easily upload JSON encoded data as the body of a request.
来源: json request option guzzle
改成这个
$request = $this->guzzleClient->put($this->url, [
'headers' => $this->dcsheaders,
'json' => [
"status" => "Open",
"accountNumber"=> "01236548",
"reasonId"=>"ccaa8e8d-70ae-466d-b8c8-dd16bc5454e0"
]
]);