Reputation: 5656
I am using Guzzle to work with the Stackoverflow API . My code is as follows
$client = new GuzzleHttp\Client();
$response = $client->get('api.stackexchange.com/2.2/search/advanced',['pagesize'=>'2','order'=>'desc','sort'=> 'activity','q'=>['laravel eloquent'],'site'=>'stackoverflow'])->send();
but I am getting this excpetion
InvalidArgumentException No method is configured to handle the pagesize config key
the complete url (on stackoverflow) that works is posted here. Note you will need to run it.
Can you please help me out with this , please ?
Upvotes: 1
Views: 2584
Reputation: 9855
From documentation, you need to add query
key:
$parameters = ['pagesize'=>'2','order'=>'desc','sort'=> 'activity','q'=>['laravel eloquent'],'site'=>'stackoverflow'];
$response = $client->get('api.stackexchange.com/2.2/search/advanced',['query' => $parameters ])->send();
Upvotes: 1