Why am I getting a 417 error response?
This can occur for a number of reasons, but if you are sending PUT, POST, or PATCH requests with an Expect: 100-Continue
header, a server that does not support this header will return a 417 response. You can work around this by setting the expect
request option to false
:
$client = new GuzzleHttp\Client();
// Disable the expect header on a single request
$response = $client->request('PUT', '/', ['expect' => false]);
// Disable the expect header on all client requests
$client = new GuzzleHttp\Client(['expect' => false]);