Answer the question
In order to leave comments, you need to log in
Is there a script for parsing the number of followers on instagram?
Tell me how you can parse the number of subscribers of the specified profile in instagram through php.
Maybe there are ready-made scripts for this.
I tried it through curl, nothing happened, it does not display the number
<?php
$url = 'https://www.instagram.com/arina_ramina/';
$curl = curl_init();
$options = [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_CONNECTTIMEOUT => 20,
CURLOPT_TIMEOUT => 20,
CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0',
CURLOPT_REFERER => 'https://www.instagram.com/',
];
curl_setopt_array($curl, $options);
$html = curl_exec($curl);
curl_close($curl);
//подписчиков
preg_match('#"edge_followed_by": {"count": (\d{1,10})}#isu',$html, $finded);
$followers = $finded[1];
echo 'Подписчиков: '.$followers;
?>
Answer the question
In order to leave comments, you need to log in
There is a library for working with Instagram for PHP, you can use it.
https://github.com/mgp25/Instagram-API
At the link you will find the library, the installation process and usage examples are also described there
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question