<?php require '../instagram.class.php'; // initialize class $instagram = new Instagram(array('apiKey' => 'db64ea18e8394b63b6c4309250b4ea6a', 'apiSecret' => '1e672be29aab4d2e88a79f3dc8919eee', 'apiCallback' => 'http://localhost/instagram/Instagram-PHP-API-master/example/success.php')); // create login URL $loginUrl = $instagram->getLoginUrl(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Instagram - OAuth Login</title> <link rel="stylesheet" type="text/css" href="assets/style.css"> <style> .login { display: block; font-size: 20px; font-weight: bold; margin-top: 50px; } </style> </head> <body> <div class="container"> <header class="clearfix"> <h1>Instagram <span>display your photo stream</span></h1> </header> <div class="main">
function get_instagram_auth_url() { global $xoousersultra_captcha_loader, $xoouserultra, $blog_id; require_once ABSPATH . 'wp-admin/includes/user.php'; require_once xoousers_path . "libs/instagram/instagram.class.php"; $YOUR_APP_KEY = $xoouserultra->get_option('instagram_client_id'); $YOUR_APP_SECRET = $xoouserultra->get_option('instagram_client_secret'); $YOUR_APP_CALLBACK = $xoouserultra->get_option('instagram_redirect_uri'); $instagram = new Instagram(array('apiKey' => $YOUR_APP_KEY, 'apiSecret' => $YOUR_APP_SECRET, 'apiCallback' => $YOUR_APP_CALLBACK)); // create login URL $loginUrl = $instagram->getLoginUrl(array('basic', 'likes', 'relationships')); return $loginUrl; }
function register_instagram() { $options_check = get_option('si_options'); $config = array('apiKey' => $options_check['instagram_app_id'], 'apiSecret' => $options_check['instagram_app_secret'], 'apiCallback' => site_url() . '/wp-admin/admin-ajax.php?action=register_instagram'); if (isset($_GET['code'])) { $options_check = get_option('si_options'); $instagram = new Instagram($config); $token = $instagram->getOAuthToken($_GET['code']); if (isset($token->access_token)) { update_option('si_oauth', $token->access_token); } else { update_option('si_oauth', 'error'); } } if (strlen($options_check['instagram_app_id']) > 0 && strlen($options_check['instagram_app_secret']) > 0) { $set = 1; } else { $set = 0; } $auth_check = get_option('si_oauth'); if (strlen($auth_check) > 0) { $auth = 1; } else { $auth = 0; } ?> <head> <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'> <link href='<?php echo plugins_url('admin/assets/css/iframe.css', __FILE__); ?> ' rel='stylesheet' type='text/css'> <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> </head> <?php if ($auth == 0) { $instagram = new Instagram($config); // Display the login button $loginUrl = $instagram->getLoginUrl(); ?> <div class="instagram"> <span><i class="fa fa-instagram"></i></span><a href="<?php echo $loginUrl; ?> " target="_blank">Login with Instagram</a> </div> <script> setTimeout(function(){ location.reload(); },5000); </script> <?php } else { if ($auth_check == 'error') { //Error with auth $instagram = new Instagram($config); // Display the login button $loginUrl = $instagram->getLoginUrl(); ?> <p>Whoops! It looks like there's a problem with your App credentials. Please check your entries in Step 02 and then use the button below to authorize the app once again.</p> <div class="instagram"> <span><i class="fa fa-instagram"></i></span><a href="<?php echo $loginUrl; ?> " target="_blank">Login with Instagram</a> </div> <script> setTimeout(function(){ location.reload(); },5000); </script> <?php } else { //We have auth credentials, check to make sure they haven't expired $instagram = new Instagram($config); $instagram->setAccessToken($auth_check); $user = $instagram->getUser(); if (isset($user->data->username)) { ?> <h2>Success!</h2> <p>Alright! You're all set up and ready to go!</p> <?php } else { //Auth token has expired. Show login button instead. $instagram = new Instagram($config); // Display the login button $loginUrl = $instagram->getLoginUrl(); ?> <p>Whoops! It looks like your authorization has expired. Please use the button below to authorize the app once again.</p> <div class="instagram"> <span><i class="fa fa-instagram"></i></span><a href="<?php echo $loginUrl; ?> " target="_blank">Login with Instagram</a> </div> <script> setTimeout(function(){ location.reload(); },5000); </script> <?php } ?> <?php } } exit; }
function hba_admin() { require_once 'instagram/instagram.php'; if (get_settings('HBA_INSTA_CLIENT_ID') != false || get_settings('HBA_INSTA_CLIENT_SECRET') != false) { $instagram = new Instagram(array('apiKey' => get_option('HBA_INSTA_CLIENT_ID'), 'apiSecret' => get_option('HBA_INSTA_CLIENT_SECRET'), 'apiCallback' => site_url() . '/wp-admin/options-general.php?page=themeOptions.php')); } if ($_REQUEST['saved']) { echo '<div id="message" class="updated fade"><p><strong>' . THEMENAME . ' settings saved.</strong></p></div>'; } ?> <h2><?php echo THEMENAME; ?> settings</h2> <form method="post" class="<?php echo THEMENAME; ?> _settings"> <div class="formRow"> <label for="phone_number">Phone Number</label> <input name="phone_number" id="phone_number" type="text" value="<?php if (get_settings('phone_number') != '') { echo get_settings('phone_number'); } ?> " /></div> <?php if ($_REQUEST['rm_hba_insta'] == true) { delete_option('HBA_INSTA_CLIENT_ID'); delete_option('HBA_INSTA_CLIENT_SECRET'); delete_option('HBA_INSTA_AUTH'); } if (get_settings('HBA_INSTA_CLIENT_ID') === false || get_settings('HBA_INSTA_CLIENT_SECRET') === false) { ?> <div class="formRow"> <label for="HBA_INSTA_CLIENT_ID">Client ID</label> <input type="text" name="HBA_INSTA_CLIENT_ID" value="<?php if (get_settings('HBA_INSTA_CLIENT_ID') != '') { echo get_settings('HBA_INSTA_CLIENT_ID'); } ?> " /> </div> <div class="formRow"> <label for="HBA_INSTA_CLIENT_SECRET">Client Secret</label> <input type="text" name="HBA_INSTA_CLIENT_SECRET" value="<?php if (get_settings('HBA_INSTA_CLIENT_SECRET') != '') { echo get_settings('HBA_INSTA_CLIENT_SECRET'); } ?> "> </div> <?php } if ($_GET['code'] == false && get_settings('HBA_INSTA_AUTH') === false && get_settings('HBA_INSTA_CLIENT_ID') != '' && get_settings('HBA_INSTA_CLIENT_SECRET') != '') { echo "<a href='{$instagram->getLoginUrl()}'>Sign in with Instagram</a>"; } ?> <?php if ($_GET['code'] != false && get_settings('HBA_INSTA_AUTH') == false) { $code = $_GET['code']; $data = $instagram->getOAuthToken($code); update_option('HBA_INSTA_AUTH', $data); } if (get_settings('HBA_INSTA_AUTH') != false) { echo 'Successfully authenticated with instagram. <a href="' . site_url() . '/wp-admin/options-general.php?page=themeOptions.php&rm_hba_insta=true">Remove user</a>'; } ?> <p class="submit"> <input name="save" type="submit" value="Save changes" class="saveButton" /> <input type="hidden" name="action" value="save" /> </p> </form> <?php }
<div class="post-image"> <img class="attachment-home-item wp-post-image" alt="facebook-logo" src="http://www.ultgate.com/instagram/ultgateinstagram.jpg"></img></div> <div class="post-title"> <h2><b>Instagram features by UltGate</b></h2> </div> <div class="post-desc clearfix"> <p> <b>Thank you for choosing UltGate Instagram features</b> We're still working on improving this section as well as on adding new features. </p> <p><b>Start using our features Now! </b> </p> <?php echo "\n<a class=\"btn-signin\" href='{$instagram->getLoginUrl(array('basic', 'likes'))}'>"; ?> <img src="images/btn-signin-instagram.png"></img></a> <section class="features"> <div class="row"> <div class="span4"> <h2>View Instagram Photos and Videos</h2> <p>View your Instagram feed on the web and iPad in our beautiful layout.</p> </div> <div class="span4"> <h2>Search for Media Using Hashtags</h2> <p>Search for media using hashtags and download them!. </p> </div>
<?php require_once 'includes/instagram.class.php'; $instagram = new Instagram(array('apiKey' => 'dd680b6585194897b537d535adb6bf07', 'apiSecret' => '2195fa0b66f74c7281af5b966cc09248', 'apiCallback' => 'http://www.ultgate.com/instagram/cb.php')); /* $instagram = new Instagram(array( 'apiKey' => '63dc1852151d4431b95a706b91581fa6', 'apiSecret' => '3ff6483836324249850217ca5b479eae', 'apiCallback' => 'http://www.ultgate.com/insta/master/cb.php' )); */ if (!$_GET['code'] && !$_COOKIE['ulttoken']) { echo "<a href='{$instagram->getLoginUrl(array('basic', 'likes'))}'>Login with Instagram</a>"; } else { if (!$_COOKIE['ulttoken']) { $code = $_GET["code"]; $data = $instagram->getOAuthToken($code); setcookie('ulttoken', $data->access_token, time() + 86400 * 7); // 86400 = 1 day $instagram->setAccessToken($data); echo '<META HTTP-EQUIV="Refresh" Content="0; URL=http://www.ultgate.com/instagram/">'; exit; } else { $instagram->setAccessToken($_COOKIE['ulttoken']); echo '<META HTTP-EQUIV="Refresh" Content="0; URL=http://www.ultgate.com/instagram/">'; exit; if (isset($_GET) && count($_GET) > 0 && $_GET['method']) { $method = $_GET['method']; switch ($method) { case 'liketag': $instagram->likeTag("hot");
* * @param bool $signedHeader * * @return void */ public function setSignedHeader($signedHeader) { $this->_signedheader = $signedHeader; } } $conf = array('apiKey' => 'e55f12fa633f403784037ba7dc72e684', 'apiSecret' => '1247122a9f0d46dd9c4ba84d96d5d030', 'apiCallback' => 'http://localhost/instagram'); $ig = new Instagram($conf); $scopes = array('basic', 'likes', 'comments', 'relationships'); ?> <a href="<?php echo $ig->getLoginUrl($scopes); ?> ">Login</a> <?php $users = $ig->searchUser('maanmughal87', 1); echo '<pre>users:'; print_r($users); $code = $_GET['code']; $data = $ig->getOAuthToken($code); echo '<pre>'; print_r($data); // set user access token $ig->setAccessToken($data); // get all user likes $likes = $ig->getUserLikes(); // take a look at the API response