アカウントのフォロワー数を php ページに表示しようとしていますが、何らかの理由でhttps://api.instagram.com/v1/users/ {$userid}/follows?access_token=を使用しようとすると{$accessToken} fetchData 行、情報が得られません。
<?php
$userinfo = fetchData("https://api.instagram.com/v1/users/{$userid}/follows?access_token={$accessToken}");
$userinfo = json_decode($userinfo);
foreach($userinfo->data as $profile) {
$followers = $profile->counts->follow_by;
echo "Followed by: ".$followers;
}
?>
しかし、別のエンドポイント コマンドで同じコードを使用し、別のデータを呼び出すと、うまく機能します (以下のように)。
<?php
$userinfo = fetchData("https://api.instagram.com/v1/users/self/feed?access_token={$accessToken}");
$userinfo = json_decode($userinfo);
foreach($userinfo->data as $profile) {
$followers = $profile->likes->count;
echo "Followed by: ".$followers;
}
?>
私が間違っているかもしれないことは何ですか?
ありがとう