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 orarray of strings. Sets the Content-Type header toapplication/x-www-form-urlencoded when no Content-Type header is alreadypresent.

  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 useone or the other. Use form_params for application/x-www-form-urlencodedrequests, and multipart for multipart/form-data requests.

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