title: CURL POST Request with Cookie Authorization
body: <p>I am trying to POST according to the following instructions:</p>
  
  <p><strong>Resource Information</strong></p>
  
  <p>HTTP Method: POST</p>
  
  <p>Content-type: application/json</p>
  
  <p>Accept: application/json</p>
  
  <p><strong>Authentication</strong></p>
  
  <p><em>Note: Either a Cookie or Authorization header is required.</em></p>
  
  <p>Cookie: SESSION_ID=108259418ff689fc</p>
  
  <p>Authorization: Basic WVdECUMScUZGGGBGOlhVODdGNXFkR253SA==</p>
  
  <p><strong>Example Request</strong></p>
  
  <p>POST <a href="https://sandbox.domain.com/api/authenticationTokens" rel="nofollow">https://sandbox.domain.com/api/authenticationTokens</a></p>
  
  <p>Cookie: SESSION_ID=cdf5b882667d24a2</p>
  
  <p>What is meant by "Either a Cookie or Authorization header is required." I don't understand how to read/interpret and implement the "Example Request".</p>
  
  <p>Here is what I have so far:</p>
  
  <pre><code>    $parameters = array();
  
      $curl = curl_init();
      $header = array( "Accept: application/json", "Cookie: _SESSION_ID=cdf5b882667d24a2" );
      curl_setopt( $curl, CURLOPT_URL, "https://sandbox.domain.com/api/authenticationTokens" );
      curl_setopt( $curl, CURLOPT_POST, count( $parameters ) );
      curl_setopt( $curl, CURLOPT_POSTFIELDS, http_build_query( $parameters ) );
      curl_setopt( $curl, CURLOPT_HTTPHEADER, $header );
      curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
      curl_setopt( $curl, CURLOPT_SSL_VERIFYHOST, false );
      curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, false );
      curl_setopt( $curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC );
      $response = curl_exec( $curl );
      curl_close( $curl );
  </code></pre>