首页 > 解决方案 > 无法获取 Instgram 关注者数量

问题描述

我想获取 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.';
}
?>

标签: php

解决方案


推荐阅读