PHP code example of pecee / instagram-sdk

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

    

pecee / instagram-sdk example snippets



    ram = new Andreyco\Instagram\Client(array(
      'apiKey'      => 'YOUR_APP_KEY',
      'apiSecret'   => 'YOUR_APP_SECRET',
      'apiCallback' => 'YOUR_APP_CALLBACK',
      'scope'       => array('basic'),
    ));

    echo "<a href='{$instagram->getLoginUrl()}'>Login with Instagram</a>";

// publish configration file
php artisan config:publish andreyco/instagram --path vendor/andreyco/instagram/src/Support/Laravel/config

// Edit app/config/packages/andreyco/instagram/config/config.php
array (
	'clientId'     => 'APPLICATION_ID',
	'clientSecret' => 'APPLICATION_SECRET',
	'redirectUri'  => 'AUTH_REDIRECT',
  'scope'        => array('basic'),
)

'providers' => array(
    'Andreyco\Instagram\Support\Laravel\ServiceProvider\Instagram',
),

'aliases' => array(
    'Instagram' => 'Andreyco\Instagram\Support\Laravel\Facade\Instagram',
),

echo "<a href='" . Instagram::getLoginUrl() . "'>Login with Instagram</a>";


    // Grab OAuth callback code
    $code = $_GET['code'];
    $data = $instagram->getOAuthToken($code);

    echo 'Your username is: ' . $data->user->username;


    // Set user access token
    $instagram->setAccessToken($data);

    // Get all user likes
    $likes = $instagram->getUserLikes();

    // Take a look at the API response
    echo '<pre>';
    print_r($likes);
    echo '<pre>';

new Instagram(array(
  'apiKey'      => 'YOUR_APP_KEY',
  'apiSecret'   => 'YOUR_APP_SECRET',
  'apiCallback' => 'YOUR_APP_CALLBACK'
));

new Instagram('YOUR_APP_KEY');

getLoginUrl(array(
  'basic',
  'likes'
), 'uMFYKG5u6v');


    // Follow the user with the ID 1574083
    $instagram->modifyRelationship('follow', 1574083);


    $photos = $instagram->getTagMedia('kitten');

    $result = $instagram->pagination($photos);