PHP code example of guzzlehttp / oauth-subscriber
1. Go to this page and download the library: Download guzzlehttp/oauth-subscriber library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
guzzlehttp / oauth-subscriber example snippets
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Subscriber\Oauth\Oauth1;
$stack = HandlerStack::create();
$stack->push(new Oauth1([
'consumer_key' => 'my_key',
'consumer_secret' => 'my_secret',
'token' => 'my_token',
'token_secret' => 'my_token_secret',
]));
$client = new Client([
'base_uri' => 'https://api.example.com/',
'handler' => $stack,
]);
$response = $client->get('resource', ['auth' => 'oauth']);