dulabs/instagram
Composer 安装命令:
composer require dulabs/instagram
包简介
Instagram OAuth 2.0 Client
README 文档
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"); }
统计信息
- 总下载量: 20
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-02-04