I'm trying to convert a piece of php code to C#. But I can't find any sample of CURLOPT_HTTPHEADER equivalent in C#. In fact the code that I try to convert is here:
$churi = curl_init($uri);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('apipass:'.$key));
$res = curl_exec($churi);
$obj = json_decode($res);
Any help will be appreciated. Thanks
If you use HttpClient
you can use the following code for adding custom request headers:
var key = "yourkey"
client.DefaultRequestHeaders.Add("apipass",key);
I hope this can help you