Curl Command Daquan and common examples

Source: Internet
Author: User
Tags http authentication http post

One, the Curl command parameter

-a/--append when uploading a file, attach to target file-a/--user-agent <string>  set user agent to send to server-anyauth   can use "any" authentication method-b/-- Cookie <name=string/file> cookie string or file read location-Basic uses HTTP Basic authentication-B/--USE-ASCII using ASCII/text transfer-c/--cookie-jar < File> write the cookie to this file after the operation is finished-c/--continue-at <offset>  breakpoint continuation-d/--data <data>   HTTP Post data transfer--data-ascii <data>  post data in ASCII--data-binary <data> post data in binary mode--negotiate      using HTTP authentication--digest        to use digital authentication--disable-eprt  Prohibit use of eprt or lprt--disable-epsv  disable the use of Epsv-d/--dump-header <file> write header information to the file--egd-file <file> Set EGD socket path for random data (SSL)--tcp-nodelay   use 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   establish a directory hierarchy of local directories--crlf           upload is to convert LF into crlf-f/--fail          HTTP error not displayed when connection fails--ftp-create-dirs if remote directory does not exist, create remote directory--ftp-method [MULTICWD/NOCWD/SINGLECWD] control the use of CWD--ftp-pasv       Ignore this IP address when using PASV/EPSV instead of port--ftp-skip-pasv-ip to use PASV--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> Simulate HTTP form submission Data-form-string <name=string> simulate HTTP form submission Data-g/--globoff disable URL sequence and range use {} and []-g/--get to send data in a get way-h/-- Help-h/--heAder <line> Custom header information is passed to the server--ignore-content-length  the length of the HTTP header information that is ignored-i/--include output includes protocol header information-i/--head   Show only document information read from file-j/--junk-session-cookies ignore 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> use specified network interface/address--KRB4 < level>  using a specified security level of Krb4-k/--insecure allows the specified configuration file to be read-l/--list-only list the file name under the FTP directory without using the certificate to the SSL site-k/--config - Limit-rate <rate> Set transfer speed--local-port<num> Force local port number-m/--max-time <seconds> set maximum transfer time--max-redirs <num> set the maximum number of directories to read--max-filesize <bytes> set the maximum amount of files downloaded-m/--manual  display full manual-n/--netrc read the user name and password from the Netrc file-- Netrc-optional use the. netrc or URL to overwrite-n--ntlm          use HTTP NTLM authentication-n/- -no-buffer Disable buffered Output-o/--output writes the output to the file-o/--remote-name writes the output to the file, retains the file name of the remote Files-p/--proxytunnel   uses the HTTP proxy-- Proxy-anyauth Select either Proxy authentication method--proxy-basic   use Basic authentication on the proxy--proxy-digest  uses the digital authentication on the proxy--proxy-ntlm    uses NTLM authentication on the proxy-p/--ftp-port <address> uses the port address, Instead of using Pasv-q/--quote <cmd> file transfer, send command to server-r/--range <range> retrieve byte range from http/1.1 or FTP server--range-file Read (SSL) random file-r/--remote-time   when a file is generated locally, keep remote file time--retry <num>   the number of retries when there is a problem with the transmission-- Retry-delay <seconds>  When there is a problem with the transmission, set the retry interval time--retry-max-time <seconds> The maximum retry time-s/--silent Mute mode when there is a problem with the transmission. Do not output anything-s/--show-error   display error--SOCKS4 

Two, commonly used curl instance

1, crawl the page content into a file

[Email protected]]# curl-o home.html http://www.codesky.net

2, with-O (uppercase), the following URL to specific to a file, or not catch it down. We can also use the regular to grab things.

[Email protected]]# curl-o http://www.codesky.net/wp-content/uploads/2010/09/compare_varnish.jpg[[email protected ]]# Curl-o http://www.codesky.net/wp-content/uploads/2010/[0-9][0-9]/aaaaa.jpg

3, simulate form information, simulate login, save cookie Information

[Email protected]]# curl-c/cookie_c.txt-f log=aaaa-f pwd=****** http://www.codesky.net/wp-login.php

4, simulating form information, simulating login, saving header information

[Email protected]]# curl-d/cookie_d.txt-f log=aaaa-f pwd=****** http://www.codesky.net/wp-login.php

The cookie generated by-C (lowercase) is not the same as the cookie in-D.

5, use cookie file

[Email protected]]# curl-b/cookie_c.txt http://www.codesky.net/wp-admin

6,https Access

[Email protected]]# curl-k  https://www.jimubox.com/User/Summary

Curl Command Daquan and common examples

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.