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:

  1. $client = new GuzzleHttp\Client();
  2. // Disable the expect header on a single request
  3. $response = $client->request('PUT', '/', ['expect' => false]);
  4. // Disable the expect header on all client requests
  5. $client = new GuzzleHttp\Client(['expect' => false]);