Show ig profile script

artomka

Junior Member
Joined
Apr 3, 2017
Messages
131
Reaction score
59
Sup guys!

I know nothing about php & I'm currently stuck with an error on my website.

I've got a scipt that Displays IG username And follower count on request :

Code:
 <?php                                 
                    $username = $_GET['username'];
                    $url = "https://www.instagram.com/" . $username;                                   
                    $data = @file_get_contents($url);
                    preg_match('/\"followed_by\"\:\s?\{\"count\"\:\s?([0-9]+)/',$data,$followed_by);
                    preg_match('/\"follows\"\:\s?\{\"count\"\:\s?([0-9]+)/',$data,$following);
                    preg_match('/\"full_name"\:\s?\"([a-zA-Z ]+)/',$data,$full_name);
                    preg_match('/\"profile_pic_url"\:\s?\"((http[s]?:\/\/)?([^\/\s]+\/)(.*?)")/',$data,$profile_pic);                 
                if ($data === false) { ?>

My problem is when anyone enters a real instagram username my website doesn't recognize it and says there is an error & enter a valid username.

What's wrong with it?
 
Back
Top