title: How do I restrict JSON access?
body: <p>I have a web application that pulls data from my newly created JSON API.</p>
  
  <p>My static HTML pages dynamically calls the JSON API via JavaScript from the static HTML page.</p>
  
  <p><strong>How do I restrict access to my JSON API so that only I (my website) can call from it?</strong></p>
  
  <p>In case it helps, my API  is something like: <a href="http://example.com/json/?var1=x&amp;var2=y&amp;var3=z" rel="nofollow noreferrer">http://example.com/json/?var1=x&amp;var2=y&amp;var3=z</a>... which generates the appropriate JSON based on the query.</p>
  
  <p>I'm using PHP to generate my JSON results ... can restricting access to the JSON API be as simple as checking the <code>$_SERVER['HTTP_REFERER']</code> to ensure that the API is only being called from my domain and not a remote user?</p>