这个php代码在c#中意味着什么?

问题描述:

PHP代码:
代码1:

PHP Code:
Code 1:

$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, 'http://www.mirrorupload.net/api/server.html');
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 15);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
$output = curl_exec($ch);
curl_close($ch);



代码2:



Code 2:

$postmember = array ();
$postmember['login'] = 'Your login';
$postmember['pass'] = 'Your password';
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, 'http://www.mirrorupload.net/api/member.html');
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 15);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postmember);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
$output = curl_exec($ch);
curl_close($ch);



代码3:



Code 3:

$postfile = array ();
$postfile['file'] = '@path_file';
$postfile['session_id'] = 'Your Session_id';
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, 'See above');
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 15);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postfile);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
$output = curl_exec($ch);
curl_close($ch);




我是C#的新手,对php一无所知.我试图使用api自动上传文件.我在网上搜索POST方法,Webrequest和其他内容,但是我真的不知道如何在我的C#程序中包含这些内容.因此,如果有人解释这些代码的实际含义以及等效的C#代码,将非常有帮助.请为我将这些代码转换为C#.




I am new to c# and don''t know anything about php. I was trying to upload files automatically using api. I search the net form POST methods and Webrequest and stuff but I really don''t know how to include these thing in my C# program. So, it''ll be really helpful if somebody explains what actually those codes mean and their equivalent c# code. Please convert these codes to C# for me. It would make sense.

ch = curl_init(); curl_setopt(
ch = curl_init(); curl_setopt (


ch,CURLOPT_URL,' http://www.mirrorupload. net/api/server.html'); curl_setopt(
ch, CURLOPT_URL, 'http://www.mirrorupload.net/api/server.html'); curl_setopt (


ch,CURLOPT_CONNECTTIMEOUT,15); curl_setopt(
ch, CURLOPT_CONNECTTIMEOUT, 15); curl_setopt (