PHP code example of aainc / instagram

1. Go to this page and download the library: Download aainc/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/ */

    

aainc / instagram example snippets



use \Munouni\Instagram\Instagram;
$instagram = new Instagram([
    'client_id'     => 'YOUR_CLIENT_KEY',
    'client_secret' => 'YOUR_CLIENT_SECRET',
    'redirect_uri'  => 'YOUR_APP_REDIRECT_URI'
]);

$loginUrl = $instagram->getOAuthUrl();

// $loginUrl = $instagram->getOAuthUrl(['basic', 'public_content', 'follower_list', 'comments', 'relationships', 'likes']);


$code = $_GET['code'];
$token = $instagram->getOAuthToken($code);


use \Munouni\Instagram\Instagram;
$instagram = new Instagram(['access_token' => 'YOUR_ACCESS_TOKEN']);
$response = $instagram->sendRequest('GET','/users/self');
$response = $instagram->sendRequest('GET','/tags/{tag-name}/', ['{tag-name}' => 'ミンゴス']);
$response = $instagram->sendRequest('GET','/tags/search',['q' => 'ミンゴス']);


use \Munouni\Instagram\Instagram;
$instagram = new Instagram(['access_token' => 'YOUR_ACCESS_TOKEN']);
$response = $instagram->sendRequest('GET','/tags/{tag-name}/media/recent',['{tag-name}' => 'ミンゴス']);
$nextResponse = $instagram->next($response);