📄 curl.html
字号:
<p class="level1">NOTE: The file size is not always known prior to download, and for such files this option has no effect even if the file transfer ends up being larger than this given limit. This concerns both FTP and HTTP transfers. <p class="level0"><a name="-m--max-time"></a><span class="nroffip">-m/--max-time <seconds></span> <p class="level1">Maximum time in seconds that you allow the whole operation to take. This is useful for preventing your batch jobs from hanging for hours due to slow networks or links going down. See also the <a class="emphasis" href="#--connect-timeout">--connect-timeout</a> option. <p class="level1">If this option is used several times, the last one will be used. <p class="level0"><a name="-M--manual"></a><span class="nroffip">-M/--manual</span> <p class="level1">Manual. Display the huge help text. <p class="level0"><a name="-n--netrc"></a><span class="nroffip">-n/--netrc</span> <p class="level1">Makes curl scan the <span Class="emphasis">.netrc</span> file in the user's home directory for login name and password. This is typically used for ftp on unix. If used with http, curl will enable user authentication. See <span Class="manpage">netrc(4)</span> or <span Class="manpage">ftp(1)</span> for details on the file format. Curl will not complain if that file hasn't the right permissions (it should not be world nor group readable). The environment variable "HOME" is used to find the home directory. <p class="level1">A quick and very simple example of how to setup a <span Class="emphasis">.netrc</span> to allow curl to ftp to the machine host.domain.com with user name 'myself' and password 'secret' should look similar to: <p class="level1"><span Class="bold">machine host.domain.com login myself password secret</span> <p class="level1">If this option is used twice, the second will again disable netrc usage. <p class="level0"><a name="--netrc-optional"></a><span class="nroffip">--netrc-optional</span> <p class="level1">Very similar to <span Class="emphasis">--netrc</span>, but this option makes the .netrc usage <span Class="bold">optional</span> and not mandatory as the <span Class="emphasis">--netrc</span> does. <p class="level0"><a name="--negotiate"></a><span class="nroffip">--negotiate</span> <p class="level1">(HTTP) Enables GSS-Negotiate authentication. The GSS-Negotiate method was designed by Microsoft and is used in their web applications. It is primarily meant as a support for Kerberos5 authentication but may be also used along with another authentication methods. For more information see IETF draft draft-brezak-spnego-http-04.txt. <p class="level1">This option requires that the library was built with GSSAPI support. This is not very common. Use <a class="emphasis" href="#-V--version">-V/--version</a> to see if your version supports GSS-Negotiate. <p class="level1">When using this option, you must also provide a fake -u/--user option to activate the authentication code properly. Sending a '-u :' is enough as the user name and password from the -u option aren't actually used. <p class="level1">If this option is used several times, the following occurrences make no difference. <p class="level0"><a name="-N--no-buffer"></a><span class="nroffip">-N/--no-buffer</span> <p class="level1">Disables the buffering of the output stream. In normal work situations, curl will use a standard buffered output stream that will have the effect that it will output the data in chunks, not necessarily exactly when the data arrives. Using this option will disable that buffering. <p class="level1">If this option is used twice, the second will again switch on buffering. <p class="level0"><a name="--ntlm"></a><span class="nroffip">--ntlm</span> <p class="level1">(HTTP) Enables NTLM authentication. The NTLM authentication method was designed by Microsoft and is used by IIS web servers. It is a proprietary protocol, reversed engineered by clever people and implemented in curl based on their efforts. This kind of behavior should not be endorsed, you should encourage everyone who uses NTLM to switch to a public and documented authentication method instead. Such as Digest. <p class="level1">If you want to enable NTLM for your proxy authentication, then use <a class="emphasis" href="#--proxy-ntlm">--proxy-ntlm</a>. <p class="level1">This option requires that the library was built with SSL support. Use <a class="emphasis" href="#-V--version">-V/--version</a> to see if your curl supports NTLM. <p class="level1">If this option is used several times, the following occurrences make no difference. <p class="level0"><a name="-o--output"></a><span class="nroffip">-o/--output <file></span> <p class="level1">Write output to <file> instead of stdout. If you are using {} or [] to fetch multiple documents, you can use '#' followed by a number in the <file> specifier. That variable will be replaced with the current string for the URL being fetched. Like in: <p class="level1"> curl http://{one,two}.site.com -o "file_#1.txt" <p class="level1">or use several variables like: <p class="level1"> curl http://{site,host}.host[1-5].com -o "#1_#2" <p class="level1">You may use this option as many times as you have number of URLs. <p class="level1">See also the <a class="emphasis" href="#--create-dirs">--create-dirs</a> option to create the local directories dynamically. <p class="level0"><a name="-O--remote-name"></a><span class="nroffip">-O/--remote-name</span> <p class="level1">Write output to a local file named like the remote file we get. (Only the file part of the remote file is used, the path is cut off.) <p class="level1">The remote file name to use for saving is extracted from the given URL, nothing else. <p class="level1">You may use this option as many times as you have number of URLs. <p class="level0"><a name="--pass"></a><span class="nroffip">--pass <phrase></span> <p class="level1">(SSL) Pass phrase for the private key <p class="level1">If this option is used several times, the last one will be used. <p class="level0"><a name="--proxy-anyauth"></a><span class="nroffip">--proxy-anyauth</span> <p class="level1">Tells curl to pick a suitable authentication method when communicating with the given proxy. This will cause an extra request/response round-trip. (Added in 7.13.2) <p class="level1">If this option is used twice, the second will again disable the proxy use-any authentication. <p class="level0"><a name="--proxy-basic"></a><span class="nroffip">--proxy-basic</span> <p class="level1">Tells curl to use HTTP Basic authentication when communicating with the given proxy. Use <a class="emphasis" href="#--basic">--basic</a> for enabling HTTP Basic with a remote host. Basic is the default authentication method curl uses with proxies. <p class="level1">If this option is used twice, the second will again disable proxy HTTP Basic authentication. <p class="level0"><a name="--proxy-digest"></a><span class="nroffip">--proxy-digest</span> <p class="level1">Tells curl to use HTTP Digest authentication when communicating with the given proxy. Use <a class="emphasis" href="#--digest">--digest</a> for enabling HTTP Digest with a remote host. <p class="level1">If this option is used twice, the second will again disable proxy HTTP Digest. <p class="level0"><a name="--proxy-ntlm"></a><span class="nroffip">--proxy-ntlm</span> <p class="level1">Tells curl to use HTTP NTLM authentication when communicating with the given proxy. Use <a class="emphasis" href="#--ntlm">--ntlm</a> for enabling NTLM with a remote host. <p class="level1">If this option is used twice, the second will again disable proxy HTTP NTLM. <p class="level0"><a name="-p--proxytunnel"></a><span class="nroffip">-p/--proxytunnel</span> <p class="level1">When an HTTP proxy is used (<a class="emphasis" href="#-x--proxy">-x/--proxy</a>), this option will cause non-HTTP protocols to attempt to tunnel through the proxy instead of merely using it to do HTTP-like operations. The tunnel approach is made with the HTTP proxy CONNECT request and requires that the proxy allows direct connect to the remote port number curl wants to tunnel through to. <p class="level1">If this option is used twice, the second will again disable proxy tunnel. <p class="level0"><a name="-P--ftp-port"></a><span class="nroffip">-P/--ftp-port <address></span> <p class="level1">(FTP) Reverses the initiator/listener roles when connecting with ftp. This switch makes Curl use the PORT command instead of PASV. In practice, PORT tells the server to connect to the client's specified address and port, while PASV asks the server for an ip address and port to connect to. <address> should be one of: <p class="level2"><p class="level1"><a name="interface"></a><span class="nroffip">interface</span> <p class="level2">i.e "eth0" to specify which interface's IP address you want to use (Unix only) <p class="level1"><a name="IP"></a><span class="nroffip">IP address</span> <p class="level2">i.e "192.168.10.1" to specify exact IP number <p class="level1"><a name="host"></a><span class="nroffip">host name</span> <p class="level2">i.e "my.host.domain" to specify machine <p class="level1"><a name="-"></a><span class="nroffip">-</span> <p class="level2">make curl pick the same IP address that is already used for the control connection <p class="level1"><p class="level1">If this option is used several times, the last one will be used. Disable the use of PORT with <a class="emphasis" href="#--ftp-pasv">--ftp-pasv</a>. Disable the attempt to use the EPRT command instead of PORT by using <a class="emphasis" href="#--disable-eprt">--disable-eprt</a>. EPRT is really PORT++. <p class="level0"><a name="-q"></a><span class="nroffip">-q</span> <p class="level1">If used as the first parameter on the command line, the <span Class="emphasis">curlrc</span> config file will not be read and used. See the <a class="emphasis" href="#-K--config">-K/--config</a> for details on the default config file search path. <p class="level0"><a name="-Q--quote"></a><span class="nroffip">-Q/--quote <command></span> <p class="level1">(FTP) Send an arbitrary command to the remote FTP server. Quote commands are sent BEFORE the transfer is taking place (just after the initial PWD command to be exact). To make commands take place after a successful transfer, prefix them with a dash '-'. To make commands get sent after libcurl has changed working directory, just before the transfer command(s), prefix the command with '+'. You may specify any amount of commands. If the server returns failure for one of the commands, the entire operation will be aborted. You must send syntactically correct FTP commands as RFC959 defines. <p class="level1">This option can be used multiple times. <p class="level0"><a name="--random-file"></a><span class="nroffip">--random-file <file></span> <p class="level1">(HTTPS) Specify the path name to file containing what will be considered as random data. The data is used to seed the random engine for SSL connections. See also the <a class="emphasis" href="#--egd-file">--egd-file</a> option. <p class="level0"><a name="-r--range"></a><span class="nroffip">-r/--range <range></span> <p class="level1">(HTTP/FTP) Retrieve a byte range (i.e a partial document) from a HTTP/1.1 or FTP server. Ranges can be specified in a number of ways. <p class="level2"><p class="level2"><span Class="bold">0-499</span> specifies the first 500 bytes <p class="level2"><span Class="bold">500-999</span> specifies the second 500 bytes <p class="level2"><span Class="bold">-500</span> specifies the last 500 bytes <p class="level2"><span Class="bold">9500-</span> specifies the bytes from offset 9500 and forward <p class="level2"><span Class="bold">0-0,-1</span> specifies the first and last byte only(*)(H) <p class="level2"><span Class="bold">500-700,600-799</span> specifies 300 bytes from offset 500(H) <p class="level2"><span Class="bold">100-199,500-599</span> specifies two separate 100 bytes ranges(*)(H) <p class="level1"><p class="level1">(*) = NOTE that this will cause the server to reply with a multipart response! <p class="level1">You should also be aware that many HTTP/1.1 servers do not have this feature enabled, so that when you attempt to get a range, you'll instead get the whole document. <p class="level1">FTP range downloads only support the simple syntax 'start-stop' (optionally with one of the numbers omitted). It depends on the non-RFC command SIZE. <p class="level1">If this option is used several times, the last one will be used. <p class="level0"><a name="-R--remote-time"></a><span class="nroffip">-R/--remote-time</span> <p class="level1">When used, this will make libcurl attempt to figure out the timestamp of the remote file, and if that is available make the local file get that same timestamp. <p class="level1">If this option is used twice, the second time disables this again. <p class="level0"><a name="--retry"></a><span class="nroffip">--retry <num></span>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -