title: Curl post to Wordpress page
body: <p>I created a custom template file, without header/footer.</p>
  
  <pre><code>&lt;?php 
  /*
  Template name: API
  */
  ?&gt;
  &lt;?php
  echo $_POST['name'];
  ?&gt;
  </code></pre>
  
  <p>I connect remotely with CURL to post the name field.</p>
  
  <pre><code>$ch = curl_init('mywebsite.com/test-page/');
  curl_setopt($ch,CURLOPT_HTTPHEADER,$headers);
  curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
  curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
  curl_setopt($ch,CURLOPT_POSTFIELDS,"name=Jason");
  curl_setopt($ch,CURLOPT_HEADER,true);
  $result = curl_exec($ch);
  curl_close($ch);
  </code></pre>
  
  <p>The headers of the response:</p>
  
  <pre><code> HTTP/1.1 302 Found Date: Tue, 30 Sep 2014 12:50:29 GMT Server: Apache/2.2.26 (Unix) mod_fastcgi/2.4.6 mod_wsgi/3.4 Python/2.7.6 PHP/5.5.10 mod_ssl/2.2.26 OpenSSL/0.9.8za DAV/2 mod_perl/2.0.8 Perl/v5.18.2 X-Powered-By: PHP/5.5.10 Expires: Wed, 11 Jan 1984 05:00:00 GMT Cache-Control: no-cache, must-revalidate, max-age=0 Pragma: no-cache Location: http://&lt;mysite&gt;/wp-login.php Content-Length: 0 Content-Type: text/html; charset=UTF-8
  </code></pre>
  
  <p>The problem is that Wordpress is redirecting this Curl request to the Wordpress login page. This is strange, since there is no login required for this page. How to solve this?</p>