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.
- $client->request('POST', '/post', [
- 'form_params' => [
- 'foo' => 'bar',
- 'baz' => ['hi', 'there!']
- ]
- ]);
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-urlencoded
requests, and multipart
for multipart/form-data
requests.
This option cannot be used with body
, multipart
, or json