private string args = "";
<summary>
Parameters
</summary>
public string Args {get {return Args;} set {args = value;}}
///<summary>
///Set parameters
//</summary>
//<param name= "value" > Parameter value </param>
public void Setarg (string value)
{
if (string. IsNullOrEmpty (args) {args = value;} else {args + = "+ value;}
}
Redirect all of the standard input and output of CMD to. NET in the program
Processstartinfo.useshellexecute = false;
Processstartinfo.redirectstandardinput = true;
Processstartinfo.redirectstandardoutput = true;
Processstartinfo.redirectstandarderror = false;
Processstartinfo.createnowindow = true;
Processstartinfo.windowstyle = Processwindowstyle.hidden;
#region Run
<summary>
Run
</summary>
<returns></returns>
public string Run ()
{
Processstartinfo.filename = Const.curlpath;
processstartinfo.arguments = args;
Try
{
Process = Process.Start (ProcessStartInfo);
}
Catch
{
return process. Standarderror.readtoend ();
}
String resaultvalue = process. Standardoutput.readtoend ();
Process. WaitForExit ();
Process. Close ();
return resaultvalue;
}
#endregion Run
1. setarg ("http://XXX.com"); Get site Content
2.
--insecure
--request PUT
--basic
-u user name: password
-X IP: Port Agent
... View the Curl command specifically
Attention
To get the error output of curl itself, use the parameter http://www.itkbase.net
-stderr "-"
% total% Received% xferd Average speed Time Time current
Dload Upload Total spent
0 0 0 0 0 0 0 0--:--:--0:00:10--:--:--0
0 0 0 0 0 0 0 0--:--:--0:00:11--:--:--0
0 0 0 0 0 0 0 0--:--:--0:00:12--:--:--0
0 0 0 0 0 0 0 0--:--:--0:00:13--:--:--0
the Curlhelper.setarg ("-S--show-error") can be used to remove
Usage:curl [Options ...] <url>
Options: (H) means Http/https only, (F) means FTP only
-a/--append Append to target file when uploading (F)
-a/--user-agent <string> user-agent to send to server (H)
--anyauth Pick "Any" authentication Method (H)
-b/--cookie <name=string/file> Cookie string or file to read the cookie from (H)
--basic Use HTTP Basic authentication (H)
-b/--use-ascii Use Ascii/text transfer
-c/--cookie-jar <file> Write Cookies to the This file after operation (H)
-c/--continue-at <offset> resumed transfer offset
-d/--data <data> HTTP POST data (H)
--data-ascii <data> HTTP POST ASCII data (H)
--data-binary <data> HTTP POST binary data (H)
--negotiate Use HTTP Negotiate authentication (H)
--digest Use HTTP Digest authentication (H)
--disable-eprt Inhibit using Eprt or LPRT (F)
--DISABLE-EPSV Inhibit using EPSV (F)
-d/--dump-header <file> Write The headers to this file
--egd-file <file> EGD Socket path for random data (SSL)
--tcp-nodelay Use the Tcp_nodelay option
-e/--referer referer URL (H)
-e/--cert <cert[:p asswd]> Client certificate file and password (SSL)
--cert-type <type> Certificate file Type (Der/pem/eng) (SSL)
--key <key> Private Key file name (SSL/SSH)
--key-type <type> Private key file Type (Der/pem/eng) (SSL)
--pass <pass> Pass phrase for the private key (SSL/SSH)
--pubkey <key> Public key file name (SSH)
--engine <eng> Crypto engine to use (SSL). "--engine List" for list
--cacert <file> CA Certificate to verify peer against (SSL)
--capath <directory> CA directory (made using C_rehash) to verify
Peer against (SSL)
--ciphers <list> SSL ciphers to use (SSL)
--compressed Request Compressed response (using deflate or gzip)
--connect-timeout <seconds> Maximum time allowed for connection
--create-dirs create necessary local directory hierarchy
--crlf Convert LF to CRLF in upload
-f/--fail fail silently (no output at all) on HTTP errors (H)
--ftp-account <data> account data to send if requested by Server (F)
--ftp-alternative-to-user String to replace "user [name]" (F)
--ftp-create-dirs Create the remote dirs if not present (F)
--ftp-method [MULTICWD/NOCWD/SINGLECWD] Control CWD usage (F)
--FTP-PASV use PASV/EPSV instead of PORT (F)
--ftp-skip-pasv-ip Skip the IP address for PASV (F)
--FTP-SSL Try SSL/TLS for FTP transfer (F)
--ftp-ssl-control Require SSL/TLS for FTP login, clear for transfer (F)
--FTP-SSL-REQD Require SSL/TLS for FTP transfer (F)
--FTP-SSL-CCC Send CCC after authenticating (F)
--ftp-ssl-ccc-mode [active/passive] Set CCC mode (F)
-f/--form <name=content> Specify HTTP multipart POST data (H)
--form-string <name=string> Specify HTTP multipart POST data (H)
-g/--globoff Disable URL sequences and ranges using {} and []
-g/--get Send the-d data with a HTTP get (H)
-h/--help this help text
-h/--header <line> Custom header to pass to server (H)
--ignore-content-length ignore the HTTP content-length header
-i/--include include protocol headers in the output (h/f)
-i/--head Show Document Info only
-j/--junk-session-cookies Ignore Session Cookies read from file (H)
--interface <interface> Specify network interface/address to use
--KRB <level> Enable Kerberos with specified security level (F)
-k/--insecure allow connections to SSL sites without certs (H)
-k/--config specify which config file to read
--libcurl <file> Dump libcurl equivalent code of this command line
-l/--list-only List Names of an FTP directory (F)
--limit-rate <rate> Limit Transfer speed
--local-port <num>[-num] Force use of these local port numbers
-l/--location follow location:hints (H)
--location-trusted follow Location:and send authentication even
to other hostnames (H)
-m/--max-time <seconds> Maximum time allowed for the transfer
--max-redirs <num> Maximum Number of redirects allowed (H)
--max-filesize <bytes> Maximum file size to download (h/f)
-m/--manual Display the full manual
-N/--NETRC must read. NETRC for user name and password
--netrc-optional use either. netrc or URL; Overrides-n
--NTLM use HTTP NTLM authentication (H)
-n/--no-buffer Disable buffering of the output stream
--no-sessionid Disable SSL Session-id reusing (SSL)
-o/--output <file> Write output to <file> instead of stdout
-o/--remote-name Write output to a file named as the remote file
-p/--proxytunnel Operate through a HTTP proxy tunnel (using CONNECT)
--proxy-anyauth Pick "Any" Proxy authentication method (H)
--proxy-basic use Basic authentication on the proxy (H)
--proxy-digest use Digest authentication on the proxy (H)
--PROXY-NTLM use NTLM authentication on the proxy (H)
-p/--ftp-port <address> use port with address instead of PASV (F)
-Q If used as the first parameter disables. CURLRC
-q/--quote <cmd> Send Command (s) to server before file transfer (F/SFTP)
-r/--range <range> Retrieve A byte range from a http/1.1 or FTP server
--random-file <file> file for reading random data from (SSL)
--raw Pass HTTP "Raw", without any transfer decoding (H)
-r/--remote-time Set The remote file ' s time on the local output
--retry <num> Retry Request <num> times if transient problems occur
--retry-delay <seconds> When retrying, wait this many seconds between each
--retry-max-time <seconds> retry only within this period
-s/--silent silent mode. Don ' t output anything
-s/--show-error Show error. With-s, make curl show errors when they occur
--SOCKS4 --SOCKS5 --stderr <file> Where to redirect stderr. -Means stdout
-t/--telnet-option <OPT=val> Set telnet option
--trace <file> Write A debug trace to the given file
--trace-ascii <file> like--trace but without the hex output
--trace-time Add time stamps to trace/verbose output
-t/--upload-file <file> Transfer <file> to remote site
--url <URL> Set URL to work with
-u/--user <user[:p assword]> Set Server user and password
-u/--proxy-user <user[:p assword]> Set Proxy User and password
-v/--verbose make the operation more talkative
-v/--version Show version number and quit
-w/--write-out [format] what to output after completion
-x/--proxy -x/--request <command> Specify request command to use
-y/--speed-time time needed to trig speed-limit abort. Defaults to 30
-y/--speed-limit Stop Transfer if below speed-limit for ' speed-time ' secs
-z/--time-cond <time> Transfer based on a time condition
-0/--http1.0 Use HTTP 1.0 (H)
-1/--tlsv1 use TLSV1 (SSL)
-2/--sslv2 use SSLv2 (SSL)
-3/--sslv3 use SSLv3 (SSL)
-4/--ipv4 Resolve name to IPV4 address
-6/--ipv6 Resolve name to IPV6 address
-#/--progress-bar Display Transfer Progress as a progress bar
Using Curl in C #