Esempio n. 1
0
 public function testConnectUrl()
 {
     $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();
     $oauth->setConfig($config);
     $login = $oauth->login(['basic', 'public_content', 'follower_list']);
     $this->dispatch($login);
     $this->assertContains('instagram.com', $login, '', true);
 }
Esempio n. 2
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use Dulabs\Instagram\OAuthManager as OAuth;
// remove it and change with your api at below.
include_once __DIR__ . '/key.php';
//$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");
}
Esempio n. 3
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use Dulabs\Instagram\OAuthManager as OAuth;
// remove it and change with your api at below.
include_once __DIR__ . '/key.php';
//$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();
$oauth->setConfig($config);
// Define scopes here
?>
<a href="<?php 
echo $oauth->login(['basic', 'public_content', 'follower_list']);
?>
">Login Instagram</a>