这个php代码在c#中意味着什么? [英] What does this php code means in c#?

查看:76
本文介绍了这个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 (


这篇关于这个php代码在c#中意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆