1. Go to this page and download the library: Download andreyco/instagram 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/ */
$instagram = new Andreyco\Instagram\Client($config);
$instagram->getLoginUrl()
// Generate and redirect to login URL.
$url = Instagram::getLoginUrl();
// After allowing to access your profile, grab authorization *code* when redirected back to your page.
$code = $_GET['code'];
$data = Instagram::getOAuthToken($code);
// Now, you have access to authentication token and user profile
echo 'Your username is: ' . $data->user->username;
echo 'Your access token is: ' . $data->access_token;
// Set user access token
Instagram::setAccessToken($accessToken);
// Get all user likes
$likes = Instagram::getUserLikes();
// Take a look at the API response
echo '<pre>';
print_r($likes);
echo '<pre>';