當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Instagram::listSubscriptions方法代碼示例

本文整理匯總了PHP中Instagram::listSubscriptions方法的典型用法代碼示例。如果您正苦於以下問題:PHP Instagram::listSubscriptions方法的具體用法?PHP Instagram::listSubscriptions怎麽用?PHP Instagram::listSubscriptions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Instagram的用法示例。


在下文中一共展示了Instagram::listSubscriptions方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: array

require_once 'Instagram.php';
/**
 * Configuration params, make sure to write exactly the ones
 * instagram provide you at http://instagr.am/developer/
 */
$config = array('client_id' => 'e8d6b06f7550461e897b45b02d84c23e', 'client_secret' => '2357fc69da344800acef2592ef647491', 'grant_type' => 'authorization_code', 'redirect_uri' => 'http://mauriciocuenca.com/qnktwit/');
/**
 * This is how a wrong response looks like
 * array(1) { ["InstagramOAuthToken"]=> string(89) "{"code": 400, "error_type": "OAuthException", "error_message": "No matching code found."}" }
 */
session_start();
if (isset($_SESSION['InstagramAccessToken']) && !empty($_SESSION['InstagramAccessToken'])) {
    header('Location: callback.php');
    die;
}
// Instantiate the API handler object
$instagram = new Instagram($config);
//Setup subscription
if (isset($rs[0]["access_token"])) {
    $instagram->setAccessToken($_SESSION['InstagramAccessToken']);
    if (isset($_GET['list'])) {
        $subscriptions = $instagram->listSubscriptions();
    } else {
        if (isset($_GET['delete'])) {
            $subscriptions = $instagram->deleteSubscription(array("object" => "all"));
        } else {
            $subscriptions = $instagram->createSubscription(array("object" => "tag", "object_id" => "mydowntown", "aspect" => "media", "callback_url" => $config['instagram']['redirect_uri'] . "subscriptions.php"));
        }
    }
    print_r($subscriptions);
}
開發者ID:Robo-romeski,項目名稱:Instagram-PHP-API,代碼行數:31,代碼來源:subscription.php


注:本文中的Instagram::listSubscriptions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。