I'm trying to upgrade a class to use GuzzleHttp\Client
to search tweets using twitter api. I'm having trouble attaching Oauth1
. It worked fine with Guzzle3 and OAuthPlugin.
Here is the code block:
$client = new Client(['base_uri' => 'https://api.twitter.com']);
$auth = new Oauth1([
'consumer_key' => Config::get('twitter.consumer_key'),
'consumer_secret' => Config::get('twitter.consumer_secret'),
'token' => Config::get('twitter.token'),
'token_secret' => Config::get('twitter.token_secret')
]);
// Not sure if this is correct
$client->getEmitter()->attach($auth); // This is line 40 inside TwitterServiceProvider.php
I get the following error:
InvalidArgumentException in Client.php line 80: Magic request methods require a URI and optional options array
1. in Client.php line 80
2. at Client->__call('getEmitter', array()) in TwitterServiceProvider.php line 40
P.S So far, I have figured, I should be using https://github.com/guzzle/oauth-subscriber. However, no luck yet.