title: Accessing Instagram's JSON without logging in
body: <p>I'm attempting to access a user's public profile page's JSON to pull information from it, but I keep getting redirected to the login page.
  I was using this link which works only when logged in. <a href="https://www.instagram.com/%7Busername%7D/?__a=1" rel="nofollow noreferrer">https://www.instagram.com/{username}/?__a=1</a></p>
  <p>Is there a way for me to grab this information without logging in?
  I'm using PHP right now.
  I want to change the static JSON file to hopefully the live Instagram link to get live updates.</p>
  <pre><code>&lt;?php 
  //This is hotpush.php
  $string = file_get_contents(&quot;test.json&quot;);
  $json_a = json_decode($string, true);
  
  
  //var_dump(json_decode($string, true));
  echo $json_a[&quot;graphql&quot;][&quot;user&quot;][&quot;edge_followed_by&quot;][&quot;count&quot;];
  
  
  ?&gt;
  </code></pre>
  <p>I have the file echoing to a webpage like so:</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;body&gt;
      &lt;div class = &quot;testing&quot;&gt;
      &lt;form action=&quot;hotpush.php&quot; method = &quot;post&quot;&gt;
          &lt;input type = &quot;text&quot; id = &quot;businesst&quot; name = &quot;businessta&quot;&gt;&lt;br&gt;
          &lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&gt;
          &lt;div class=&quot;msg&quot;&gt;&lt;/div&gt;
      &lt;/form&gt;
      &lt;/div&gt;
      &lt;script&gt;
          document.querySelector(&quot;.testing form&quot;).onsubmit = function(event) {
              event.preventDefault();
              var form_data = new FormData(document.querySelector(&quot;.testing form&quot;));
              var xhr = new XMLHttpRequest();
              xhr.open(&quot;POST&quot;, document.querySelector(&quot;.testing form&quot;).action, true);
              xhr.onload = function () {
                  if (this.responseText.toLowerCase().indexOf(&quot;success12312414sadadasf1&quot;) !== -1) {
                      window.location.href = &quot;thankyou.html&quot;;
                  } else {
                      document.querySelector(&quot;.msg&quot;).innerHTML = this.responseText;
                  }
              };
              xhr.send(form_data);
          };
      &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt; 
  </code></pre>