php - 无法获取 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.';
}
?>
解决方案
推荐阅读
- javascript - 添加到 pdf 自定义 html 而不将其添加到 DOM
- mysql - 将 Sequelize 连接到 MySQL 生成访问被拒绝错误
- python - dask 性能随着传递给 dask.compute 且 scheduler='processes' 的延迟对象数量的增加而降低
- jenkins - 如何让詹金斯在 git 中寻找拉取请求,而不是在詹金斯中触发 git 工作?
- java - 在 Spring 应用程序中设置查询超时连接的问题
- apache-spark - 修改 Spark DataFrame 结构
- crystal-reports - 如果满足条件,则返回先前的公式结果
- xcode - Xcode:模板不显示
- sql - 没有明确列出列名的 SQL 联合 NULL 列
- go - 除了结构字段标签之外的其他元数据