Get All Details Of Instagram Users

Fetch details using API's without Authentication

techhawa-instagram-get-details

Instagram is a social networking app made for sharing photos and videos from a smartphone. Similar to Facebook or Twitter, everyone who creates an Instagram account has a profile and a news feed.

This is a guide for web developers interested in integrating Instagram content on websites. In this tutorial i will guide how to get the details of Instagram user like name account-id, images, videos, followers, total-post and following.

Advantages of this method

  • No need to create Instagram account
  • No Authentication required to access API's.
  • Fetch all details of users (public accounts).

GET USER DETAILS USING INSTAGRAM API'S

  • First create a HTML file as userform.html and save the below code

  • <!DOCTYPE html>
    <html lang="en">
    <head>
      <title>Techhawa - Get Instagram User Details</title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
      <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    </head>
    <body>
    
    <div class="container">
      <h2>Techhawa - Instagram Form</h2>
      <form class="form-horizontal" action="Instagram-user-detail.php">
        <div class="form-group">
          <div class="col-sm-10">
            <input type="text" class="form-control" id="instagram-user" placeholder="Username" name="instagram-user">
          </div>
        </div>
        
      
        <div class="form-group">        
          <div class="col-sm-offset-2 col-sm-10">
            <button type="submit" class="btn btn-default">Submit</button>
          </div>
        </div>
      </form>
    </div>
    
    </body>
    </html>
    

  • Now create one PHP file as Instagram-user-detail.php and paste the below code.

  • <?php
    $user_name = $_GET['instagram-user'];
    $curl = curl_init();
    
    curl_setopt_array($curl, array(
      CURLOPT_URL => "https://www.instagram.com/$user_name/?__a=1",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "GET",
      CURLOPT_HTTPHEADER => array(
        "cache-control: no-cache",
        "content-type: application/json",
        "postman-token: cc3e7f07-b49c-4040-b511-c7f1af596954"
      ),
    ));
    
    $response = curl_exec($curl);
    $err = curl_error($curl);
    
    curl_close($curl);
    
    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
    
    ?>
    

  • Now open userform.html file in the browser.
  • Enter some sample Instaram username and click on submit button.
  • Note: In this tutorial, we use narendramodi as Instagram user-name.


    instagram-user-details-form
  • After submittion, you will see the JSON response of your Instagram user as shown below

  • instagram-user-json-response


Know More About Us