0
這裏是我的CURL例如,通過API作者提供:另一個捲曲C#轉換嘗試
$data = array("username" => "XX", "password" => "XX");
$data_string = json_encode($data);
$ch = curl_init('https://<url excluded>');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
//Attached the path to .CRT file
curl_setopt($ch, CURLOPT_CAINFO, getcwd() ."/AddTrustExternalCARoot.crt");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: '
. strlen($data_string))
);
$result = curl_exec($ch);
echo $result;
方法應返回用於後續API調用使用的字母數字API密鑰。我所有使用WebClient和HttpRequest的嘗試都返回了400或403錯誤。
任何幫助,我可以弄清楚正確的C#庫和語法會很好。
看看http://restsharp.org,它提供了你需要的一切 –