php-guzzleHow to add an application/x-www-form-urlencoded header in PHP Guzzle?
Adding an application/x-www-form-urlencoded header in PHP Guzzle can be done using the setHeader method.
Example code
$client = new \GuzzleHttp\Client();
$client->setHeader('Content-Type', 'application/x-www-form-urlencoded');
The code above creates a new Guzzle client and sets the header Content-Type to application/x-www-form-urlencoded.
Code explanation
$client = new \GuzzleHttp\Client();- creates a new Guzzle client$client->setHeader('Content-Type', 'application/x-www-form-urlencoded');- sets the headerContent-Typetoapplication/x-www-form-urlencoded
Helpful links
More of Php Guzzle
- How to keep alive with Guzzle in PHP?
- How to log requests with Guzzle in PHP?
- How to handle a RequestException with PHP Guzzle?
- How to install PHP Guzzle without Composer?
- How to use PHP Guzzle to make a batch request?
- What version of PHP is required for Guzzle?
- How to set a user agent in PHP Guzzle?
- How to update PHP Guzzle?
- How to make HTTP request with PHP Guzzle?
- How to set a timeout for a Guzzle client in PHP?
See more codes...