title: Sending Custom Header with CURL
body: <p>I want to send a request to a web service via an API as shown below, i have to pass
  a custom http header(Hash), i'm using CURL, my code seems to work but I'm not getting
  the rigth response, I'm told it has to do with the hash value, though the value has
  been seen to be correct, is there anything wrong with the way I'm passing it or with
  the code itself. </p>
  
  <pre><code> &lt;?php
      $ttime=time();
      $hash="123"."$ttime"."dfryhmn";
      $hash=hash("sha512","$hash");
      $curl = curl_init();
      curl_setopt($curl,CURLOPT_HTTPHEADER,array('Hash:$hash'));      
      curl_setopt ($curl, CURLOPT_URL, 'http://web-service-api.com/getresult.xml?clientid=456&amp;time=$ttime');  
      curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);  
      $xml = curl_exec ($curl);  
  
      if ($xml === false) {
          die('Error fetching data: ' . curl_error($curl));  
      }
      curl_close ($xml);  
  
      echo htmlspecialchars("$xml", ENT_QUOTES);
  
      ?&gt;
  </code></pre>