1. Go to this page and download the library: Download hannesvdvreken/php-oauth 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/ */
$twitter = new OAuth\Services\Twitter($redirectUri, $credentials);
// Request token for redirecting the user (store it in session afterwards).
$token = $twitter->requestToken();
// Get the url to which we need to redirect the user.
$url = $twitter->authorizationUrl();
// Redirect the user.
header('Location: '. $url); exit;
// Get the url to which we need to redirect the user.
$url = $twitter->authorizationUrl();
// Get the requestToken that has been requested.
$token = $twitter->getToken();
// And store it.
// And redirect the user.
header('Location: '. $url); exit;
// Give the stored token back to the service class.
$twitter->setToken($token);
// Exchange the get parameters for an access token.
$token = $twitter->accessToken($oauthToken, $oauthVerifier);
// Do a get request, just like you would do with a Guzzle Client.
$profile = $twitter->get('account/verify_credentials.json')->json();
$fb = new OAuth\Services\Facebook();
$url = $fb->authorizationUrl();
header('Location: '. $url);