For Guzzle 5, 6 and 7 you do it like this:
use GuzzleHttp\Client;
$client = new Client();
$response = $client->post('url', [
GuzzleHttp\RequestOptions::JSON => ['foo' => 'bar'] // or 'json' => [...]
]);
More Related Contents:
- Guzzlehttp – How get the body of a response from Guzzle 6?
- PATCH and PUT Request Does not Working with form-data
- Guzzle: handle 400 bad request
- Catching exceptions from Guzzle
- 3rd party dependency conflict in developing WordPress Plugin
- Handle Guzzle exception and get HTTP body
- Converting a POSTMAN request to Curl
- What is the postman-token header attribute in generated code from Postman?
- Guzzle 6: no more json() method for responses
- Sending POST parameters with Postman doesn’t work, but sending GET parameters does
- Upload file using Guzzle 6 to API endpoint
- Guzzle 6 progress of download
- How to perform multiple Guzzle requests at the same time?
- How do you log all API calls using Guzzle 6
- Convert seconds to Hour:Minute:Second
- Run php script as daemon process
- PHP Sort Array By SubArray Value
- How to extend access token validity since offline_access deprecation
- ByetHost server passing html values “Checking your browser” with JSON String
- PHP Change Array Keys
- How to check for null in Twig?
- Replace string in text file using PHP
- How to create a subquery using Laravel Eloquent?
- Can I do a CURL request to the same server?
- how to embed html files in php code?
- How do I save PHP session data to a database instead of in the file system?
- Escaping SQL queries in Codeigniter
- displaying a message after redirecting the user to another web page [duplicate]
- How to call a php function from ajax?
- Sending XML data using HTTP POST with PHP