Show ig profile script

Discussion in 'PHP & Perl' started by artomka, Sep 6, 2017.

  1. artomka

    artomka Junior Member

    Joined:
    Apr 3, 2017
    Messages:
    124
    Likes Received:
    56
    Gender:
    Male
    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?
     
  2. mnunes532

    mnunes532 Elite Member

    Joined:
    Jan 21, 2014
    Messages:
    1,757
    Likes Received:
    587
    Gender:
    Male
    Location:
    Portugal
    • Thanks Thanks x 1
  3. redarrow

    redarrow Elite Member

    Joined:
    Apr 1, 2013
    Messages:
    7,455
    Likes Received:
    1,901
    nice code go and

    // tell everybody what the code does this way you wont be bugged, what does what...

    nice code well written

    can do with some cheeks, but nice
     
  4. artomka

    artomka Junior Member

    Joined:
    Apr 3, 2017
    Messages:
    124
    Likes Received:
    56
    Gender:
    Male
    Looks cool!

    Going to give it a shot :D

    Thank you alot, I really appreciate it :)
     
  5. fanmonster

    fanmonster Newbie

    Joined:
    Jan 29, 2018
    Messages:
    31
    Likes Received:
    4
    Gender:
    Male
    I have the same issues and when I tried the code in
    it doesn't work.

    Anybody have the answer on this?
     
  6. mnunes532

    mnunes532 Elite Member

    Joined:
    Jan 21, 2014
    Messages:
    1,757
    Likes Received:
    587
    Gender:
    Male
    Location:
    Portugal
    It should work, what's wrong?