function get_user_media(Instagram $instagram) { $userData = $instagram->getUser(); $userMedia = $instagram->getUserMedia('self'); $userLikes = $instagram->getUserLikes($userMedia); $userComments = $instagram->getUserComments($userMedia); $userTags = $instagram->getUserTags($userMedia); $data = array('userData' => $userData, 'userMedia' => $userMedia, 'userLikes' => $userLikes, 'userComments' => $userComments, 'userTags' => $userTags); if ($data) { return $data; } return false; }
require 'instagram/vendor/cosenary/instagram/src/Instagram.php'; use MetzWeb\Instagram\Instagram; $insta = new Instagram(array('apiKey' => '41f65a5c684048bca797dbf0775c9ec7', 'apiSecret' => '95647e6ef2a445ff92e8b27c82bf8da6', 'apiCallback' => 'http://localhost/JSfaceLogin/Instagram/instagram.php')); if (isset($_GET['code'])) { echo $_GET['code']; $accessToken = $insta->getOAuthToken($_GET['code']); $insta->setAccessToken($accessToken); $token = $insta->getAccessToken() . '<br>'; print_r($accessToken); $id = $accessToken->user->id; echo $full_name = $accessToken->user->username; echo '<pre>'; echo '</pre>'; $imagen = $accessToken->user->profile_picture; echo '<img src="' . $imagen . '"/>'; echo $insta->getUserLikes(1)->data[0]->likes->count . "Me gusta"; $follow = $insta->getUserFollows(); print_r($insta->getUserMedia()); } else { // check whether an error occurred if (isset($_GET['error'])) { echo 'An error occurred: ' . $_GET['error_description']; } //print_r($insta->getUserLikes(1)); } ?> <!doctype html> <html> <body> <img src="instagram.ico" height="42" width="42" > <a src="instagram.ico" href = "<?php
<?php use MetzWeb\Instagram\Instagram; $instagram = new Instagram(array('apiKey' => '41ef4cd023ca47c79ef0f5cb7505033d', 'apiSecret' => 'dc6ec29ac5ce4b7e88e98dc89a7517db', 'apiCallback' => 'http://www.3dcrestwhite.ru/automation/')); $instagram->getLoginUrl(array('basic', 'likes')); echo "<a href='{$instagram->getLoginUrl()}'>Login with Instagram</a>" . '<br>'; // grab OAuth callback code $code = get_query_var('code'); $data = $instagram->getOAuthToken($code); echo 'Your username is: ' . $data->user->username . '<br>'; //print_r($data) ; $token = $data->access_token; echo 'TOKEN: ' . $token . '<br>'; $instagram->setAccessToken($token); $likes = $instagram->getUserLikes(); // take a look at the API response echo '<pre>'; print_r($likes); echo '<pre>'; $followers = $instagram->getUserFollower('vaha_13', 10); echo '--------------------<br>'; print_r($followers); /* foreach($followers as $val){ print_r($val); echo '<br><br>'; } */ ?>