无法获取Instgram关注者的人数

时间:2019-03-26 06:51:03

标签: php

我想获取Instagram粉丝数,但无法获取,我正在实现以下代码以获取数量。

<?php
$username = 'shubhamtester14';
$response = @file_get_contents( "https://www.instagram.com/$username/?__a=1" );
if ( $response !== false ) {
    $data = json_decode( $response, true );
    if ( $data !== null ) {
        $full_name = $data['graphql']['user']['full_name'];
        $follower  = $data['graphql']['user']['edge_followed_by']['count'];
        echo "{$full_name} have {$follower} followers.";
    }
} else {
    echo 'Username not found.';
}
?>

0 个答案:

没有答案