I want to use the following cURL command from python in C#, but I haven't found any way to do so.
$ curl --data "type=AUTH&code=CODE" https://example.com
I hope you can help me out with this issue I'm facing.
I want to use the following cURL command from python in C#, but I haven't found any way to do so.
$ curl --data "type=AUTH&code=CODE" https://example.com
I hope you can help me out with this issue I'm facing.
As pointed out by @Filburt you can use HttpClient to post data using C#
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("https://example.com");
var content = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("type", "AUTH"),
new KeyValuePair<string, string>("code", "CODE")
});
var result = await client.PostAsync("", content);
string resultContent = await result.Content.ReadAsStringAsync();
Console.WriteLine(resultContent);
}