How can I create aRequest using guzzleHttp?

I used GuzzleHttp, I created a request for the following commands:

use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;

$url = 'http://localhost/api/get_data?token=123456';
$client = new Client();
$request = $client->createRequest('GET', $url, []);

      

But error

:

Argument 3 passed to GuzzleHttp\Client::request() must be of the type array, string given, called in /home/datnq/www/slim/vendor/guzzlehttp/guzzle/src/Client.php on line 88 and defined

      

Why did I miss? I think the parameters are right!

+3


source to share


1 answer


The reason why this is a use for Guzzle 5.x, however, this post is most likely due to the use of 6.x versions. I would post a link to the 6.x version of the docs, but all I can find is http://guzzle.readthedocs.org/en/latest/quickstart.html and it has no semantic version.



+4


source







All Articles