コード例 #1
0
ファイル: OAuthManagerTest.php プロジェクト: dulabs/instagram
 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);
 }
コード例 #2
0
ファイル: callback.php プロジェクト: dulabs/instagram
<?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");
}
コード例 #3
0
ファイル: index.php プロジェクト: dulabs/instagram
<?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>