dulabs/instagram

Instagram OAuth 2.0 Client

Installs: 20

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/dulabs/instagram

1.0.0 2016-02-04 05:34 UTC

This package is not auto-updated.

Last update: 2025-10-12 01:36:37 UTC


README

Wrapper for new Instagram API

Installation

Download branch master https://github.com/dulabs/new-instagram-api/archive/master.zip

See index.php to auth user with instagram.

See callback.php to get access token.

Login

require_once(__DIR__.'/../vendor/autoload.php');

use Dulabs\Instagram\OAuthManager as OAuth;

$config['api_key'] = "";
$config['api_secret'] = "";
$config['callback_url'] = "http://localhost/instagram/demo/callback.php";
$config['response_type'] = OAuth::RESPONSE_TYPE_CODE;

$oauth = new OAuth();

// initialiaze config
$oauth->setConfig($config);

// define scopes
$loginurl = $oauth->login(['basic','public_content','follower_list']);

header("location: ".$loginurl);

Callback

require_once(__DIR__.'/../vendor/autoload.php');

use Dulabs\Instagram\OAuthManager as OAuth;

$config['api_key'] = "";
$config['api_secret'] = "";
$config['callback_url'] = "http://localhost/instagram/callback.php";
$config['response_type'] = OAuth::RESPONSE_TYPE_CODE;

// We need to configure OAuth
$oauth = new OAuth();
$oauth->setConfig($config);

if(isset($_GET['code']) && !empty($_GET['code']))
{
	$token = $oauth->getAccessToken();
	setcookie("instagram_token",$token,time()+3600);
	header("location: demo.php");
}