-7

im trying to convert a PHP file to C#. the problem is that I don't know the equivalent .net commands to curl.

ob_start(); 
$ret = curl_exec($ch);
$content = ob_get_contents();
ob_end_clean(); 
$rescode = curl_getinfo($ch, CURLINFO_HTTP_CODE); 
curl_close($ch); 

i have tried to find all this information but wheat i have found is only fractured bits of code that are incompatible.

mattzuton
  • 31
  • 4
  • 1
    SO isn't a "convert my code" service. Do please head over to [the tour](http://stackoverflow.com/tour) to get a better idea of how SO works and what kind of questions are appropriate here. – Epodax Jan 13 '16 at 11:21
  • 1
    Possibly already answered here http://stackoverflow.com/questions/7929013/making-a-curl-call-in-c-sharp – Krystian Laskowski Jan 13 '16 at 11:22
  • If you're trying to implement some functionality in C#, then learning and writing some C# code would be a good place to start. What specific functionality are you trying to implement? What is stopping you from doing that? – David Jan 13 '16 at 11:28

1 Answers1

0

You do not specify anything, not even if it is a GET or POST, but this is an example from Postman using restsharp

var client = new RestClient("https://google.com");
var request = new RestRequest(Method.GET);
request.AddHeader("postman-token", "49bab31b-6be2-5862-e3ca-351cb8b35d86");
request.AddHeader("cache-control", "no-cache");
IRestResponse response = client.Execute(request);
online Thomas
  • 8,864
  • 6
  • 44
  • 85