PHP code example of ym-careers / hybridauth
1. Go to this page and download the library: Download ym-careers/hybridauth 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/ */
ym-careers / hybridauth example snippets
$config = [
'callback' => 'https://example.com/path/to/script.php',
'keys' => [ 'key' => 'your-twitter-consumer-key', 'secret' => 'your-twitter-consumer-secret' ]
];
try {
$twitter = new Hybridauth\Provider\Twitter($config);
$twitter->authenticate();
$accessToken = $twitter->getAccessToken();
$userProfile = $twitter->getUserProfile();
$apiResponse = $twitter->apiRequest('statuses/home_timeline.json');
}
catch (\Exception $e) {
echo 'Oops, we ran into an issue! ' . $e->getMessage();
}