form_params

Summary

Used to send an application/x-www-form-urlencoded POST request.

Types

array

Constant

GuzzleHttp\RequestOptions::FORM_PARAMS

Associative array of form field names to values where each value is a string or array of strings. Sets the Content-Type header to application/x-www-form-urlencoded when no Content-Type header is already present.

  1. $client->request('POST', '/post', [
  2. 'form_params' => [
  3. 'foo' => 'bar',
  4. 'baz' => ['hi', 'there!']
  5. ]
  6. ]);

Note

form_params cannot be used with the multipart option. You will need to use one or the other. Use form_params for application/x-www-form-urlencoded requests, and multipart for multipart/form-data requests.

This option cannot be used with body, multipart, or json