Q: curl Equivalent in C# i have the following code in php that runs perfect, the problem is that its slow, since its run several times in a loop. And implementing multithreading in php is another problem all together. But i know how to do multithreading in C#, so if anyone can convert this function to a C# i will handle the multithreading part. 
 function process_registration($reg,$phone,$key,$secret)
   {
    $fields['regno']= $reg; 
    $fields['phone']= $phone; 
    $fields['key']= $key;
    $fields['secret']= $secret;
    $process = curl_init('http://theip/registrationsearch/confirm_status.php'); 
    curl_setopt($process, CURLOPT_POSTFIELDS, $fields);
    curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);
    $result = curl_exec($process);
    $the_data=json_decode($result,true);
    if($the_data['Status']==='Ok') return $the_data['registration_details'];
    else return $the_data['Status'];
    }

I want to implement this in a C# console application. So that i can implement C#'s Multithreading capabilities.
I have tried using HttpClient with no success, can anyone help?
This is the function i did in C# but i get no response no error message
static async Task<int> MainAsync(string[] args)
    {
        var client = new HttpClient();
        var keyValues = new List<KeyValuePair<string, string>>();
        keyValues.Add(new KeyValuePair<string, string>("key", args[0]));
        keyValues.Add(new KeyValuePair<string, string>("secret", args[1]));
        keyValues.Add(new KeyValuePair<string, string>("phone", args[2]));
        keyValues.Add(new KeyValuePair<string, string>("regno", args[3]));

        var requestContent = new FormUrlEncodedContent(keyValues);

        HttpResponseMessage response = await client.PostAsync("http://theip/registrationsearch/confirm_status.php", requestContent);
        HttpContent responseContent = response.Content;
        Console.WriteLine("Waiting for response...");

        using (var reader = new StreamReader(await responseContent.ReadAsStreamAsync()))
        {
            Console.WriteLine(await reader.ReadToEndAsync());
        }
        return 1;
    }


A: private static async void TestAsyncPost()
{
  var values = new Dictionary<string, string>();
  values.Add("regno", "testReg");
  values.Add("phone", "testPhone");
  values.Add("key", "testKey");
  values.Add("secret", "testSecret");
  var content = new FormUrlEncodedContent(values);
  using (var client = new HttpClient())
  {
    try
    {
      var httpResponseMessage = await client.PostAsync("http://theip/registrationsearch/confirm_status.php", content);
      if (httpResponseMessage.StatusCode == HttpStatusCode.OK)
      {
        // Do something...
        var response = await httpResponseMessage.Content.ReadAsStringAsync();
        Trace.Write(response);  // response here...
      }
    }
    catch (Exception ex)
    {
      Trace.Write(ex.ToString()); // error here...
    }
  }
}

