title: Passing on a curl request to a local php file?
body: <p>I am trying to hack together a simple authentication system. The hope is that this will stop remote requests from being sent to a specific php page on my server, and will only process pages it authenticates are originating from the server itself.</p>
  
  <p>Here's the basic concept:</p>
  
  <p>home.php -> AJAX request to auth.php with data -> all $_GET variables taken and sent along with an authentication code to product.php -> product.php sends response to auth.php -> auth.php mirrors this response back to the AJAX call.</p>
  
  <p>The authetication code is an md5 token of microtime + salt. I was initially going to pass on these requests directly to product.php from home.php, but the issue is that the token + time are sent along in the AJAX request (2 of 3 variables). The only way I can think of hiding this information is to have it slapped onto the request by a second internal php page (auth.php) and then pass it on to product.php. This way there is no exposure of an authentication code even being present.</p>
  
  <p>My question is - how can I complete this chain with auth.php passing on the request to product.php. I'd like to make it a local request to mitigate the impact of having this buffer php page in between the previous request model, but it has to mirror the characteristics of a regular AJAX / curl request in that it needs to pass on a bunch of variables and then receive a response back.</p>
  
  <p>To simplify my question a little further - would something like </p>
  
  <pre><code>curl_setopt($ch, CURLOPT_URL, "product.php");
  </code></pre>
  
  <p>work for my purposes? Is there something more efficient?</p>