dongsuyou6938 2016-01-13 11:20
浏览 67
已采纳

将php转换为c#,curl转换为.net [关闭]

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.

  • 写回答

1条回答 默认 最新

  • dpnv33177 2016-01-13 11:26
    关注

    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);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序