Home  >  Article  >  Operation and Maintenance  >  Linux: curl

Linux: curl

PHP中文网
PHP中文网Original
2017-07-07 18:16:421537browse
[user@localhost ~]$ curl -<span style="color: #000000;">h
Usage: curl [options...] </span><url><span style="color: #000000;">
Options: (H) means HTTP</span>/<span style="color: #000000;">HTTPS only, (F) means FTP only
     </span>--anyauth       Pick <span style="color: #800000;">"</span><span style="color: #800000;">any</span><span style="color: #800000;">"</span><span style="color: #000000;"> authentication method (H)
 </span>-a, --append        Append to target <span style="color: #0000ff;">file</span> when uploading (F/<span style="color: #000000;">SFTP)
     </span>--<span style="color: #000000;">basic         Use HTTP Basic Authentication (H)
     </span>--<span style="color: #000000;">cacert FILE   CA certificate to verify peer against (SSL)
     </span>--<span style="color: #000000;">capath DIR    CA directory to verify peer against (SSL)
 </span>-E, --cert CERT[:PASSWD] Client certificate <span style="color: #0000ff;">file</span><span style="color: #000000;"> and password (SSL)
     </span>--cert-type TYPE Certificate <span style="color: #0000ff;">file</span> type (DER/PEM/<span style="color: #000000;">ENG) (SSL)
     </span>--<span style="color: #000000;">ciphers LIST  SSL ciphers to use (SSL)
     </span>--compressed    Request compressed response (using deflate or <span style="color: #0000ff;">gzip</span><span style="color: #000000;">)
 </span>-K, --config FILE   Specify <span style="color: #0000ff;">which</span> config <span style="color: #0000ff;">file</span><span style="color: #000000;"> to read
     </span>--connect-timeout SECONDS  Maximum <span style="color: #0000ff;">time</span> allowed <span style="color: #0000ff;">for</span><span style="color: #000000;"> connection
 </span>-C, --continue-<span style="color: #000000;">at OFFSET  Resumed transfer offset
 </span>-b, --cookie STRING/FILE  String or <span style="color: #0000ff;">file</span><span style="color: #000000;"> to read cookies from (H)
 </span>-c, --cookie-jar FILE  Write cookies to this <span style="color: #0000ff;">file</span><span style="color: #000000;"> after operation (H)
     </span>--create-<span style="color: #000000;">dirs   Create necessary local directory hierarchy
     </span>--crlf          Convert LF to CRLF <span style="color: #0000ff;">in</span><span style="color: #000000;"> upload
     </span>--crlfile FILE  Get a CRL list <span style="color: #0000ff;">in</span> PEM format from the given <span style="color: #0000ff;">file</span>
 -d, --<span style="color: #000000;">data DATA     HTTP POST data (H)
     </span>--data-<span style="color: #000000;">ascii DATA  HTTP POST ASCII data (H)
     </span>--data-<span style="color: #000000;">binary DATA  HTTP POST binary data (H)
     </span>--data-<span style="color: #000000;">urlencode DATA  HTTP POST data url encoded (H)
     </span>--delegation STRING GSS-<span style="color: #000000;">API delegation permission
     </span>--<span style="color: #000000;">digest        Use HTTP Digest Authentication (H)
     </span>--disable-<span style="color: #000000;">eprt  Inhibit using EPRT or LPRT (F)
     </span>--disable-<span style="color: #000000;">epsv  Inhibit using EPSV (F)
 </span>-D, --dump-header FILE  Write the headers to this <span style="color: #0000ff;">file</span>
     --egd-<span style="color: #0000ff;">file</span> FILE  EGD socket path <span style="color: #0000ff;">for</span><span style="color: #000000;"> random data (SSL)
     </span>--engine ENGINGE  Crypto engine (SSL). <span style="color: #800000;">"</span><span style="color: #800000;">--engine list</span><span style="color: #800000;">"</span> <span style="color: #0000ff;">for</span><span style="color: #000000;"> list
 </span>-f, --<span style="color: #000000;">fail          Fail silently (no output at all) on HTTP errors (H)
 </span>-F, --<span style="color: #000000;">form CONTENT  Specify HTTP multipart POST data (H)
     </span>--form-<span style="color: #0000ff;">string</span><span style="color: #000000;"> STRING  Specify HTTP multipart POST data (H)
     </span>--<span style="color: #0000ff;">ftp</span>-account DATA  Account data <span style="color: #0000ff;">string</span><span style="color: #000000;"> (F)
     </span>--<span style="color: #0000ff;">ftp</span>-alternative-to-user COMMAND  String to replace <span style="color: #800000;">"</span><span style="color: #800000;">USER [name]</span><span style="color: #800000;">"</span><span style="color: #000000;"> (F)
     </span>--<span style="color: #0000ff;">ftp</span>-create-dirs  Create the remote dirs <span style="color: #0000ff;">if</span><span style="color: #000000;"> not present (F)
     </span>--<span style="color: #0000ff;">ftp</span>-method [MULTICWD/NOCWD/<span style="color: #000000;">SINGLECWD] Control CWD usage (F)
     </span>--<span style="color: #0000ff;">ftp</span>-pasv      Use PASV/<span style="color: #000000;">EPSV instead of PORT (F)
 </span>-P, --<span style="color: #0000ff;">ftp</span>-<span style="color: #000000;">port ADR  Use PORT with given address instead of PASV (F)
     </span>--<span style="color: #0000ff;">ftp</span>-skip-pasv-ip Skip the IP address <span style="color: #0000ff;">for</span><span style="color: #000000;"> PASV (F)
     </span>--<span style="color: #0000ff;">ftp</span>-pret      Send PRET before PASV (<span style="color: #0000ff;">for</span><span style="color: #000000;"> drftpd) (F)
     </span>--<span style="color: #0000ff;">ftp</span>-ssl-<span style="color: #000000;">ccc   Send CCC after authenticating (F)
     </span>--<span style="color: #0000ff;">ftp</span>-ssl-ccc-mode ACTIVE/<span style="color: #000000;">PASSIVE  Set CCC mode (F)
     </span>--<span style="color: #0000ff;">ftp</span>-ssl-control Require SSL/TLS <span style="color: #0000ff;">for</span> <span style="color: #0000ff;">ftp</span> <span style="color: #0000ff;">login</span>, <span style="color: #0000ff;">clear</span> <span style="color: #0000ff;">for</span><span style="color: #000000;"> transfer (F)
 </span>-G, --get           Send the -<span style="color: #000000;">d data with a HTTP GET (H)
 </span>-g, --<span style="color: #000000;">globoff       Disable URL sequences and ranges using {} and []
 </span>-H, --<span style="color: #000000;">header LINE   Custom header to pass to server (H)
 </span>-I, --<span style="color: #0000ff;">head</span>          Show document <span style="color: #0000ff;">info</span><span style="color: #000000;"> only
 </span>-h, --<span style="color: #000000;">help          This help text
     </span>--hostpubmd5 MD5  Hex encoded MD5 <span style="color: #0000ff;">string</span><span style="color: #000000;"> of the host public key. (SSH)
 </span>-<span style="color: #800080;">0</span>, --http1.<span style="color: #800080;">0</span>       Use HTTP <span style="color: #800080;">1.0</span><span style="color: #000000;"> (H)
     </span>--ignore-content-length  Ignore the HTTP Content-<span style="color: #000000;">Length header
 </span>-i, --include       Include protocol headers <span style="color: #0000ff;">in</span> the output (H/<span style="color: #000000;">F)
 </span>-k, --<span style="color: #000000;">insecure      Allow connections to SSL sites without certs (H)
     </span>--interface INTERFACE  Specify network interface/<span style="color: #000000;">address to use
 </span>-<span style="color: #800080;">4</span>, --<span style="color: #000000;">ipv4          Resolve name to IPv4 address
 </span>-<span style="color: #800080;">6</span>, --<span style="color: #000000;">ipv6          Resolve name to IPv6 address
 </span>-j, --junk-session-cookies Ignore session cookies read from <span style="color: #0000ff;">file</span><span style="color: #000000;"> (H)
     </span>--keepalive-<span style="color: #0000ff;">time</span><span style="color: #000000;"> SECONDS  Interval between keepalive probes
     </span>--key KEY       Private key <span style="color: #0000ff;">file</span> name (SSL/<span style="color: #000000;">SSH)
     </span>--key-type TYPE Private key <span style="color: #0000ff;">file</span> type (DER/PEM/<span style="color: #000000;">ENG) (SSL)
     </span>--<span style="color: #000000;">krb LEVEL     Enable Kerberos with specified security level (F)
     </span>--<span style="color: #000000;">libcurl FILE  Dump libcurl equivalent code of this command line
     </span>--limit-<span style="color: #000000;">rate RATE  Limit transfer speed to this rate
 </span>-l, --list-<span style="color: #000000;">only     List only names of an FTP directory (F)
     </span>--local-<span style="color: #000000;">port RANGE  Force use of these local port numbers
 </span>-L, --<span style="color: #000000;">location      Follow redirects (H)
     </span>--location-trusted like --<span style="color: #000000;">location and send auth to other hosts (H)
 </span>-M, --<span style="color: #000000;">manual        Display the full manual
     </span>--mail-<span style="color: #000000;">from FROM  Mail from this address
     </span>--mail-<span style="color: #000000;">rcpt TO  Mail to this receiver(s)
     </span>--mail-<span style="color: #000000;">auth AUTH  Originator address of the original email
     </span>--max-filesize BYTES  Maximum <span style="color: #0000ff;">file</span> size to download (H/<span style="color: #000000;">F)
     </span>--max-<span style="color: #000000;">redirs NUM  Maximum number of redirects allowed (H)
 </span>-m, --max-<span style="color: #0000ff;">time</span> SECONDS  Maximum <span style="color: #0000ff;">time</span> allowed <span style="color: #0000ff;">for</span><span style="color: #000000;"> the transfer
     </span>--metalink      Process given URLs as metalink XML <span style="color: #0000ff;">file</span>
     --<span style="color: #000000;">negotiate     Use HTTP Negotiate Authentication (H)
 </span>-n, --netrc         Must read .netrc <span style="color: #0000ff;">for</span><span style="color: #000000;"> user name and password
     </span>--netrc-optional Use either .netrc or URL; overrides -<span style="color: #000000;">n
     </span>--netrc-<span style="color: #0000ff;">file</span><span style="color: #000000;"> FILE  Set up the netrc filename to use
 </span>-N, --no-<span style="color: #000000;">buffer     Disable buffering of the output stream
     </span>--no-<span style="color: #000000;">keepalive  Disable keepalive use on the connection
     </span>--no-sessionid  Disable SSL session-<span style="color: #000000;">ID reusing (SSL)
     </span>--noproxy       List of hosts <span style="color: #0000ff;">which</span> <span style="color: #0000ff;">do</span><span style="color: #000000;"> not use proxy
     </span>--<span style="color: #000000;">ntlm          Use HTTP NTLM authentication (H)
 </span>-o, --output FILE   Write output to <<span style="color: #0000ff;">file</span>><span style="color: #000000;"> instead of stdout
     </span>--pass PASS     Pass phrase <span style="color: #0000ff;">for</span> the private key (SSL/<span style="color: #000000;">SSH)
     </span>--post301       Do not switch to GET after following a <span style="color: #800080;">301</span><span style="color: #000000;"> redirect (H)
     </span>--post302       Do not switch to GET after following a <span style="color: #800080;">302</span><span style="color: #000000;"> redirect (H)
     </span>--post303       Do not switch to GET after following a <span style="color: #800080;">303</span><span style="color: #000000;"> redirect (H)
 </span>-#, --progress-<span style="color: #000000;">bar  Display transfer progress as a progress bar
     </span>--proto PROTOCOLS  Enable/<span style="color: #000000;">disable specified protocols
     </span>--proto-redir PROTOCOLS  Enable/<span style="color: #000000;">disable specified protocols on redirect
 </span>-x, --proxy [PROTOCOL:<span style="color: #008000;">//</span><span style="color: #008000;">]HOST[:PORT] Use proxy on given port</span>
     --proxy-anyauth Pick <span style="color: #800000;">"</span><span style="color: #800000;">any</span><span style="color: #800000;">"</span><span style="color: #000000;"> proxy authentication method (H)
     </span>--proxy-<span style="color: #000000;">basic   Use Basic authentication on the proxy (H)
     </span>--proxy-<span style="color: #000000;">digest  Use Digest authentication on the proxy (H)
     </span>--proxy-<span style="color: #000000;">negotiate Use Negotiate authentication on the proxy (H)
     </span>--proxy-<span style="color: #000000;">ntlm    Use NTLM authentication on the proxy (H)
 </span>-U, --proxy-<span style="color: #000000;">user USER[:PASSWORD]  Proxy user and password
     </span>--proxy1.<span style="color: #800080;">0</span> HOST[:PORT]  Use HTTP/<span style="color: #800080;">1.0</span><span style="color: #000000;"> proxy on given port
 </span>-p, --<span style="color: #000000;">proxytunnel   Operate through a HTTP proxy tunnel (using CONNECT)
     </span>--pubkey KEY    Public key <span style="color: #0000ff;">file</span><span style="color: #000000;"> name (SSH)
 </span>-Q, --quote CMD     Send command(s) to server before transfer (F/<span style="color: #000000;">SFTP)
     </span>--random-<span style="color: #0000ff;">file</span> FILE  File <span style="color: #0000ff;">for</span><span style="color: #000000;"> reading random data from (SSL)
 </span>-r, --<span style="color: #000000;">range RANGE   Retrieve only the bytes within a range
     </span>--raw           Do HTTP <span style="color: #800000;">"</span><span style="color: #800000;">raw</span><span style="color: #800000;">"</span><span style="color: #000000;">, without any transfer decoding (H)
 </span>-e, --<span style="color: #000000;">referer       Referer URL (H)
 </span>-J, --remote-header-name Use the header-<span style="color: #000000;">provided filename (H)
 </span>-O, --remote-name   Write output to a <span style="color: #0000ff;">file</span> named as the remote <span style="color: #0000ff;">file</span>
     --remote-name-all Use the remote <span style="color: #0000ff;">file</span> name <span style="color: #0000ff;">for</span><span style="color: #000000;"> all URLs
 </span>-R, --remote-<span style="color: #0000ff;">time</span>   Set the remote <span style="color: #0000ff;">file</span><span style="color: #800000;">'</span><span style="color: #800000;">s time on the local output</span>
 -X, --<span style="color: #000000;">request COMMAND  Specify request command to use
     </span>--<span style="color: #000000;">resolve HOST:PORT:ADDRESS  Force resolve of HOST:PORT to ADDRESS
     </span>--retry NUM   Retry request NUM times <span style="color: #0000ff;">if</span><span style="color: #000000;"> transient problems occur
     </span>--retry-delay SECONDS When retrying, <span style="color: #0000ff;">wait</span><span style="color: #000000;"> this many seconds between each
     </span>--retry-max-<span style="color: #0000ff;">time</span><span style="color: #000000;"> SECONDS  Retry only within this period
 </span>-S, --show-error    Show error. With -s, <span style="color: #0000ff;">make</span><span style="color: #000000;"> curl show errors when they occur
 </span>-s, --silent        Silent mode. Don<span style="color: #800000;">'</span><span style="color: #800000;">t output anything</span>
     --socks4 HOST[:PORT]  SOCKS4 proxy on given host +<span style="color: #000000;"> port
     </span>--socks4a HOST[:PORT]  SOCKS4a proxy on given host +<span style="color: #000000;"> port
     </span>--socks5 HOST[:PORT]  SOCKS5 proxy on given host +<span style="color: #000000;"> port
     </span>--socks5-<span style="color: #0000ff;">hostname</span><span style="color: #000000;"> HOST[:PORT] SOCKS5 proxy, pass host name to proxy
     </span>--socks5-gssapi-service NAME  SOCKS5 proxy service name <span style="color: #0000ff;">for</span><span style="color: #000000;"> gssapi
     </span>--socks5-gssapi-<span style="color: #000000;">nec  Compatibility with NEC SOCKS5 server
 </span>-Y, --speed-limit RATE  Stop transfers below speed-limit <span style="color: #0000ff;">for</span> <span style="color: #800000;">'</span><span style="color: #800000;">speed-time</span><span style="color: #800000;">'</span><span style="color: #000000;"> secs
 </span>-y, --speed-<span style="color: #0000ff;">time</span> SECONDS  Time <span style="color: #0000ff;">for</span> trig speed-limit abort. Defaults to <span style="color: #800080;">30</span>
     --ssl           Try SSL/<span style="color: #000000;">TLS (FTP, IMAP, POP3, SMTP)
     </span>--ssl-reqd      Require SSL/<span style="color: #000000;">TLS (FTP, IMAP, POP3, SMTP)
 </span>-<span style="color: #800080;">2</span>, --<span style="color: #000000;">sslv2         Use SSLv2 (SSL)
 </span>-<span style="color: #800080;">3</span>, --<span style="color: #000000;">sslv3         Use SSLv3 (SSL)
     </span>--ssl-allow-<span style="color: #000000;">beast Allow security flaw to improve interop (SSL)
     </span>--stderr FILE   Where to redirect stderr. -<span style="color: #000000;"> means stdout
     </span>--tcp-<span style="color: #000000;">nodelay   Use the TCP_NODELAY option
 </span>-t, --telnet-option OPT=<span style="color: #000000;">VAL  Set telnet option
     </span>--tftp-blksize VALUE  Set TFTP BLKSIZE option (must be ><span style="color: #800080;">512</span><span style="color: #000000;">)
 </span>-z, --<span style="color: #0000ff;">time</span>-cond TIME  Transfer based on a <span style="color: #0000ff;">time</span><span style="color: #000000;"> condition
 </span>-<span style="color: #800080;">1</span>, --tlsv1         Use =><span style="color: #000000;"> TLSv1 (SSL)
     </span>--tlsv1.<span style="color: #800080;">0</span>       Use TLSv1.<span style="color: #800080;">0</span><span style="color: #000000;"> (SSL)
     </span>--tlsv1.<span style="color: #800080;">1</span>       Use TLSv1.<span style="color: #800080;">1</span><span style="color: #000000;"> (SSL)
     </span>--tlsv1.<span style="color: #800080;">2</span>       Use TLSv1.<span style="color: #800080;">2</span><span style="color: #000000;"> (SSL)
     </span>--trace FILE    Write a debug trace to the given <span style="color: #0000ff;">file</span>
     --trace-ascii FILE  Like --<span style="color: #000000;">trace but without the hex output
     </span>--trace-<span style="color: #0000ff;">time</span>    Add <span style="color: #0000ff;">time</span> stamps to trace/<span style="color: #000000;">verbose output
     </span>--<span style="color: #0000ff;">tr</span>-<span style="color: #000000;">encoding   Request compressed transfer encoding (H)
 </span>-T, --upload-<span style="color: #0000ff;">file</span><span style="color: #000000;"> FILE  Transfer FILE to destination
     </span>--<span style="color: #000000;">url URL       URL to work with
 </span>-B, --use-ascii     Use ASCII/<span style="color: #000000;">text transfer
 </span>-u, --<span style="color: #000000;">user USER[:PASSWORD]  Server user and password
     </span>--<span style="color: #000000;">tlsuser USER  TLS username
     </span>--<span style="color: #000000;">tlspassword STRING TLS password
     </span>--<span style="color: #000000;">tlsauthtype STRING  TLS authentication type (default SRP)
     </span>--unix-<span style="color: #000000;">socket FILE    Connect through this UNIX domain socket
 </span>-A, --user-agent STRING  User-<span style="color: #000000;">Agent to send to server (H)
 </span>-v, --verbose       Make the operation <span style="color: #0000ff;">more</span><span style="color: #000000;"> talkative
 </span>-V, --<span style="color: #000000;">version       Show version number and quit
 </span>-<span style="color: #0000ff;">w</span>, --<span style="color: #0000ff;">write</span>-<span style="color: #000000;">out FORMAT  What to output after completion
     </span>--xattr        Store metadata <span style="color: #0000ff;">in</span> extended <span style="color: #0000ff;">file</span><span style="color: #000000;"> attributes
 </span>-q                 If used as the first parameter disables .curlrc

 

The above is the detailed content of Linux: curl. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn