I need get photos and descriptions from registered instagram. As I understand from docs on github https://github.com/cosenary/Instagram-PHP-API You need put auth link first ant then using auth token after click on it you are redirected to some callback url, where you can get media then. But can I somehow login automatically without clicking link?? I have some
$instagram = new Instagram(array(
'apiKey' => 'apiKey',
'apiSecret' => 'apiSecret',
'apiCallback' => 'apiCallback there'
));
with my data get after registration in https://www.instagram.com/developer/ . How can I get what I want?
I guess try something like this:
$userid = "User-ID-Goes-Here";
$accessToken = "Token-Goes-Here";
// Gets our data
function fetchData($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
// Pulls and parses data.
$result = fetchData("https://api.instagram.com/v1/users/{$userid}/media/recent/?access_token={$accessToken}");
$result = json_decode($result);
//use data here
Source: http://blueprintinteractive.com/blog/how-instagram-api-fancybox-simplified
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.