title: Secure ajax GET/POST request for server
body: <p>suppose I work with some kind of API and my file <strong>server.php</strong> handles the connection to the API service. on my client side I use AJAX call like this:</p>
  
  <pre><code>$http({
           url : 'server/server.php',
           method : 'GET',
           data : { getContent : true }
       });
  </code></pre>
  
  <p>in my server.php I handle it like this:  </p>
  
  <pre><code>if(isset($_GET['getContent'])){
      $content = get_content();
  }
  
  function get_content(){...}
  </code></pre>
  
  <p>i just wonder what prevents any one send AJAX call with the same getContent parameter and get all my data? how can i secure it and make sure only calls from my application will get the relevant data back?</p>
  
  <p>thank you!</p>