title: Validate curl CURLOPT_HTTPHEADER request on server side
body: <p>I have developed a small webservice which will take user query and returns data as json response. Everything working fine. But I was wondering how to set and compare 
  Authorization token from the client side as part of the curl header. This is my code to send request . Still I didn't set any validation thing on FetchData.php. I want to implement that on FetchData.php. How to implement that ?</p>
  
  <pre><code>$query = "select * from product_details where id = 2";
  $query_params = array("query" =&gt; $query); 
  $url = "http://localhost/api/fetchData.php?" . http_build_query($query_params, '', "&amp;");
  $curl = curl_init();
  $token = 'ABCD123456';
  $header[] = 'Authorization: Token '.$token;
  curl_setopt_array($curl, array(
  CURLOPT_RETURNTRANSFER =&gt; 1,
  CURLOPT_URL =&gt; $url,
  CURLOPT_HTTPGET=&gt;1,
  CURLOPT_FAILONERROR=&gt; 1,
  CURLOPT_RETURNTRANSFER=&gt; true,
  CURLOPT_HTTPHEADER=&gt;$header
  ));
  
  $resp = curl_exec($curl);
  if($resp === false)  
  {
      $responseJson = new stdClass(); 
      $responseJson-&gt;status =  "FAILED";
      $responseJson-&gt;message = 'Send error: ' . curl_error($curl);
      throw new Exception(curl_error($curl)); 
  }
  else{
      $resp = curl_exec($curl);
  }
  </code></pre>
  
  <p>In the above code I have added this authorization token . But acutually this was not set on server side I mean in <code>fetchData.php</code>.</p>
  
  <pre><code>$token = 'ABCD123456';
  $header[] = 'Authorization: Token '.$token;
  </code></pre>
  
  <p>so my question is how to set up this authorization token thing in <code>fetchData.php</code> and validate the token which was from client side? Any help would be greatly appreciated.</p>