Query String Parameters
You can provide query string parameters with a request in several ways.
You can set query string parameters in the request’s URI:
$response = $client->request('GET', 'http://httpbin.org?foo=bar');
You can specify the query string parameters using the query
request option as an array.
$client->request('GET', 'http://httpbin.org', [
'query' => ['foo' => 'bar']
]);
Providing the option as an array will use PHP’s http_build_query
function to format the query string.
And finally, you can provide the query
request option as a string.
$client->request('GET', 'http://httpbin.org', ['query' => 'foo=bar']);