title: How to send cookie in request to API In php via Curl
body: <p>I am having HTTP cookie based Authentication,After Authentication i get cookie in response, </p>
  
  <p>Another step is to send cookie in request to API. along with post/get request</p>
  
  <p>Below Example is of my Curl</p>
  
  <pre><code>$cookie_jar= $_COOKIE['DesigntoolAuth'];
  //$ch = curl_init($url);                                                                      
  // The data to send to the API
  $postData = array(
      'ProjectId' =&gt; $projectId,
      'ProjectName' =&gt; $proname,
      'ProjectDetails' =&gt; $details, 
      'UserId' =&gt; $userId
  );
  
  $data_string = json_encode($postData);  
  // Setup cURL
  $ch = curl_init($url);
  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");                                                                     
  curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);                                                                  
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);   
  curl_setopt($ch, CURLOPT_VERBOSE, true);  
  curl_setopt($c, CURLOPT_COOKIEFILE, $cookie_jar);                                                                 
  curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
      'Content-Type: application/json'                                                                             
      //'Content-Length: ' . strlen($data_string)
      ));                                                                   
  
      $api_result =  curl_exec($ch);
      echo $api_result;
  </code></pre>
  
  <p>Can Anybody tell how ti send the cookie ?</p>