<?php ini_set('display_errors', 'off'); require '../vendor/autoload.php'; // initialize class $instagram = new Andreyco\Instagram\Client(array('apiKey' => 'YOUR_APP_KEY', 'apiSecret' => 'YOUR_APP_SECRET', 'apiCallback' => 'YOUR_APP_CALLBACK')); // receive OAuth code parameter $code = $_GET['code']; // check whether the user has granted access if (isset($code)) { // receive OAuth token object $data = $instagram->getOAuthToken($code); $username = $username = $data->user->username; // store user access token $instagram->setAccessToken($data); // now you have access to all authenticated user methods $result = $instagram->getUserMedia(); } else { // check whether an error occurred if (isset($_GET['error'])) { echo 'An error occurred: ' . $_GET['error_description']; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Instagram - photo stream</title>
<?php // ini_set('display_errors', 'off'); require '../vendor/autoload.php'; $instagram = new Andreyco\Instagram\Client(array('apiKey' => 'YOUR_APP_KEY', 'apiSecret' => 'YOUR_APP_SECRET', 'apiCallback' => 'YOUR_APP_CALLBACK', 'scope' => array('basic', 'comments', 'relationships', 'likes'))); // create login URL $state = md5(time()); $loginUrl = $instagram->getLoginUrl(array('relationships'), $state); ?> <!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>
function prefix_instagram() { $instagram = new Andreyco\Instagram\Client('c95bb5db73c64f55b7cee8430926ecfe'); $data = $instagram->getUserMedia('instagramid', 5); return $data->data; }
<?php ini_set('display_errors', 'off'); require '../vendor/autoload.php'; $instagram = new Andreyco\Instagram\Client('YOUR_APP_KEY'); $result = $instagram->getPopularMedia(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Instagram - popular photos</title> <link href="https://vjs.zencdn.net/4.2/video-js.css" rel="stylesheet"> <link href="assets/style.css" rel="stylesheet"> <script src="https://vjs.zencdn.net/4.2/video.js"></script> </head> <body> <div class="container"> <header class="clearfix"> <img src="assets/instagram.png" alt="Instagram logo"> <h1>Instagram <span>popular photos</span></h1> </header> <div class="main"> <ul class="grid"> <?php foreach ($result->data as $media) { $content = "<li>"; // output media if ($media->type === 'video') {