Instagram – PHP get Follower Count

How to get the followers of an instagram account with php:

$response = shell_exec("curl 'https://www.instagram.com/nasa/?__a=1' -H 'authority: www.instagram.com' -H 'cache-control: max-age=0' -H 'upgrade-insecure-requests: 1' -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36' -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8' -H 'accept-encoding: gzip, deflate, br' -H 'accept-language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7' -H 'cookie: mid=W9W5NAAJKDNKAJSDnUu7NuBs-veMCDLv; mcd=3; fbm_1240287414=base_domain=.instagram.com; ig_cb=1; csrftoken=6VJb4WDTKKNFFFFFGJsOkaDAAvI31bAF; ds_user_id=8183434384; ds_user_id=81245498384; csrftoken=6VJb4WDTqnBZA8aNKNFDFFDAAvI31bAF; mid=W_nErSAKDNn4lVKMway-5f; shbid=18941; shbts=154362342.0652436; rur=FTW; sessionid=IGSC9aef5bd23432415f8505f9c84d6evQRu3Ofg%3A%7B%22_auth_user_id%22%3A8%2C%22_auth_user_backend%22%3A%22accounts.backends.CaseInsensitiveModelBackend%22%2C%22_auth_user_hash%22%32C%22_platform%22%3A4%2C%22_token_ver%22%3%22_token%22%3A%22814812%2C%22last_refreshed%22%3A15437D;' --compressed");
if ($response !== false) {
$data = json_decode($response, true);
if ($data !== null) {
$followedBy = $data['graphql']['user']['edge_followed_by']['count'];
echo $followedBy;
}
}

Kommentar verfassen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.