Common Curl basic commands for web apps

Source: Internet
Author: User
Tags add time curl http authentication http post

Common commands for Web development, field deployment, or problem tracking:

One, GET request

Curl "http://www.baidu.com" if the URL here points to a file or a picture can be downloaded directly to the local

Curl-i "http://www.baidu.com" Show All information

Curl-l "http://www.baidu.com" only displays header information

Curl-v "Http://www.baidu.com" shows the full process of GET request parsing

Curl http://127.0.0.1:8080/check_your_status?user=Summer&passwd=12345678

  wget "Http://www.baidu.com" can also be

Second, POST request

Curl-d "Param1=value1&param2=value2" "http://www.baidu.com"

Third, delete request

Curl-i-X DELETE HTTPS://API.GITHUB.CIM

Note: x/--request <command> specify what command (Note: X indicates the request, x/follows the method)

Iv. Uploading Files

Curl--form "[email protected]" Http://hostname/resource

Note:-f/--form <name=content> analog HTTP form submission data

V. POST request in JSON format

Curl-k-H "Content-type:application/json"-X post-d ' {"Parameter1": "Test1", "Paramerter2": "Test2":} '/HTTP/ 192.168.1.1:8090/getday

Note:-d/--data <data> HTTP post mode transfer data

-k/--insecure allow non-use of certificates to SSL sites

-k/--config The specified configuration file read

X/--request <command> Specify what commands

-h/--header <line> Custom header information to the server

The following is a description of the parameters of the Curl command

Linux Curl Command

-a/--append attaching to the destination file when uploading a file-a/--user-agent <string> set up user agent to send to server-Anyauth can use "any" authentication method-b/--cookie <name=string/file> Cookie string or file read location-Basic authentication using HTTP-B/--USE-ASCII using ASCII/text transfer-c/--cookie-jar <file> Write cookies to this file after the operation is complete-c/--continue-at <offset> Breakpoint Continuation-d/--data <data> HTTP Post mode transfer data--data-ascii <data> Post data in ASCII mode--data-binary <data> post data in binary mode--negotiate using HTTP authentication--digest using digital authentication--disable-eprt prohibit the use of eprt or LPrt--DISABLE-EPSV prohibit the use of EPSV-d/--dump-header <file> Write header information to this file--egd-file <file> Set EGD socket path for random data (SSL)--tcp-nodelay using the tcp_nodelay option-e/--referer Source URL-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)--key-type <type> private key file type (Der/pem/eng) (SSL)--pass <pass> private key Password (SSL)--engine <eng> Encryption engine use (SSL). "--engine list" for list--cacert <file> CA certificate (SSL)--capath <directory> CA directory (made using C_rehash) to verify peer against (SSL)--ciphers <list> SSL Password--compressed Requirements Return is a compressed situation (using deflate or gzip)--connect-timeout <seconds> Set maximum request time--create-dirs Creating a directory hierarchy of local directories--crlf upload is to convert LF into CRLFHTTP Error not displayed when-f/--fail connection fails--ftp-create-dirs If the remote directory does not exist, create a remote directory--ftp-method [MULTICWD/NOCWD/SINGLECWD] controlling the use of CWD--FTP-PASV using PASV/EPSV instead of ports--ftp-skip-pasv-ip When using PASV, ignore the IP address--ftp-ssl attempt to use SSL/TLS for FTP data transfer--FTP-SSL-REQD requires SSL/TLS for FTP data transfer-f/--form <name=content> Analog HTTP form submission data-form-string <name=string> Analog HTTP form submission data-g/--globoff Disable URL sequence and range using {} and []-g/--get sending data in a get way-h/--help Help-h/--header <line> Custom header information to the server--ignore-content-length The length of the HTTP header information ignored-i/--include output includes protocol header information-i/--head Display only Document informationread-j/--junk-session-cookies from file ignores session cookie-Interface <interface> Specify network interface/address usage-KRB4 < level > enable with the specified security level KRB4-j/--junk-session-cookies read file into ignore session cookie--interface <interface> using specified network interface/address--krb4 <level> using KRB4 with the specified security level-k/--insecure allow non-use of certificates to SSL sites-k/--config The specified configuration file read-l/--list-only lists the file names under the FTP directory--limit-rate <rate> Set transfer speed--local-port<num> forcing the use of local port numbers-m/--max-time <seconds> Set maximum transfer time--max-redirs <num> Set the maximum number of read directories--max-filesize <bytes> Set the maximum amount of files to download-m/--manual Display full manual-N/--NETRC to read the user name and password from the Netrc file--netrc-optional use. netrc or URL to overwrite-n--NTLM using HTTP NTLM authentication-n/--no-buffer disabling buffered output-o/--output writes the output to the file-o/--remote-name writes the output to the file, preserving the file name of the remote-p/--proxytunnel using an HTTP proxy--proxy-anyauth Select either proxy authentication method--proxy-basic using Basic authentication on the agent--proxy-digest using digital authentication on the proxy--PROXY-NTLM using NTLM authentication on the agent-p/--ftp-port <address> use port address instead of PASV-q/--quote <cmd> Send a command to the server before transferring the file-r/--range <range> Retrieving byte ranges from http/1.1 or FTP servers--range-file Read (SSL) random files-r/--remote-time Preserve remote file time when generating files locally--retry <num> Number of retries when there is a problem with the transmission--retry-delay <seconds> Set retry interval when problems occur with transmission--retry-max-time <seconds> Set maximum retry time when there is a problem with the transmission-s/--silent Mute mode. Don't output anything.-s/--show-error Display Error--socks4 --socks5 --stderr <file>-t/--telnet-option <OPT=val> telnet option settings--trace <file> Debug a specified file--trace-ascii <file> like--trace but no hex outputadd time stamp when--trace-time trace/verbose output-t/--upload-file <file> Uploading Files--url <URL> spet URL to work with-u/--user <user[:p assword]> setting up the user and password for the server-u/--proxy-user <user[:p assword]> Setting the proxy user name and password-v/--verbose-v/--version displaying version information-w/--write-out [format] What output is complete-x/--proxy -x/--request <command> Specify what commands-y/--speed-time the time required to abandon the speed limit. Default is-y/--speed-limit Stop transmission speed limit, speed time ' s-z/--time-cond transfer Time setting-0/--http1.0 using HTTP 1.0-1/--tlsv1 using TLSv1 (SSL)-2/--sslv2 using SSLv2 (SSL)-3/--sslv3 used by SSLv3 (SSL)--3p-quote like-q for the source URL for 3rd party transfer--3p-url using URLs for third-party transfers--3p-user third-party transfer using username and password-4/--ipv4 using IP4-6/--ipv6 using IP6-#/--progress-bar Displays the current delivery status with a progress bar

Common Curl basic commands for web apps

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.