如何從Instagram API獲取用戶圖像?如何使用Instagram API獲取圖像
=的access_token 4049241557.1677ed0.5324ad17d9314645b528ad112da8d56e
但沒有成功,它給我的只有用戶信息。 如何使用Instagram API獲取圖像?
如何從Instagram API獲取用戶圖像?如何使用Instagram API獲取圖像
=的access_token 4049241557.1677ed0.5324ad17d9314645b528ad112da8d56e
但沒有成功,它給我的只有用戶信息。 如何使用Instagram API獲取圖像?
使用此API:
https://api.instagram.com/v1/users/self/media/recent?access_token={access-token}
這將讓你的照片,(但它看起來像從access_token
您已發佈,該用戶沒有任何的照片貼出來,所以它會返回空數組)
使用此得到其他用戶的照片:
https://api.instagram.com/v1/users/{user-id}/media/recent?access_token={access-token}
你應該有public_content
範圍,如果你是在沙盒模式,只有SAN認證dbox用戶可以訪問,直到您的應用程序進行審查和生活
您可以使用此庫Cosenary。
use MetzWeb\Instagram\Instagram;
$instagram = new Instagram(array(
'apiKey' => 'YOUR_APP_KEY',
'apiSecret' => 'YOUR_APP_SECRET',
'apiCallback' => 'YOUR_APP_CALLBACK'
));
// grab OAuth callback code
$code = $_GET['code'];
// or maybe $code = $request->code; // if you are using Laravel
$data = $instagram->getOAuthToken($code);
// set user access token
$instagram->setAccessToken($data);
// and
$pictures = $instagram->getUserMedia();
閱讀文檔以獲取更多信息。
希望這會有所幫助。
檢查此鏈接:https://code.tutsplus.com/tutorials/introduction-to-the-instagram-api--cms-23608 – fernando