Instagram api 获取照片却未获取 link
Instagram api getting photos without getting link
我需要从已注册的 Instagram 获取照片和描述。
据我了解 github https://github.com/cosenary/Instagram-PHP-API 上的文档
您需要首先放置 auth link ant,然后在单击它后使用 auth 令牌,您将被重定向到某个回调 url,然后您可以在其中获取媒体。但是我可以不点击 link 就自动登录吗?
我有一些
$instagram = new Instagram(array(
'apiKey' => 'apiKey',
'apiSecret' => 'apiSecret',
'apiCallback' => 'apiCallback there'
));
用我的数据在https://www.instagram.com/developer/注册后得到。我怎样才能得到我想要的?
我想尝试这样的事情:
$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
来源:http://blueprintinteractive.com/blog/how-instagram-api-fancybox-simplified
我需要从已注册的 Instagram 获取照片和描述。 据我了解 github https://github.com/cosenary/Instagram-PHP-API 上的文档 您需要首先放置 auth link ant,然后在单击它后使用 auth 令牌,您将被重定向到某个回调 url,然后您可以在其中获取媒体。但是我可以不点击 link 就自动登录吗? 我有一些
$instagram = new Instagram(array(
'apiKey' => 'apiKey',
'apiSecret' => 'apiSecret',
'apiCallback' => 'apiCallback there'
));
用我的数据在https://www.instagram.com/developer/注册后得到。我怎样才能得到我想要的?
我想尝试这样的事情:
$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
来源:http://blueprintinteractive.com/blog/how-instagram-api-fancybox-simplified