⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 curl.1

📁 harvest是一个下载html网页得机器人
💻 1
📖 第 1 页 / 共 3 页
字号:
.\" You can view this file with:.\" nroff -man curl.1.\" Written by Daniel Stenberg.\".TH curl 1 "22 Oct 2003" "Curl 7.10.8" "Curl Manual".SH NAMEcurl \- transfer a URL.SH SYNOPSIS.B curl [options].I [URL...].SH DESCRIPTION.B curlis a tool to transfer data from or to a server, using one of the supportedprotocols (HTTP, HTTPS, FTP, FTPS, GOPHER, DICT, TELNET, LDAP or FILE). Thecommand is designed to work without user interaction.curl offers a busload of useful tricks like proxy support, userauthentication, ftp upload, HTTP post, SSL (https:) connections, cookies, filetransfer resume and more. As you will see below, the amount of features willmake your head spin!curl is powered by libcurl for all transfer-related features. See.BR libcurl (3)for details..SH URLThe URL syntax is protocol dependent. You'll find a detailed description inRFC 2396.You can specify multiple URLs or parts of URLs by writing part sets withinbraces as in: http://site.{one,two,three}.comor you can get sequences of alphanumeric series by using [] as in: ftp://ftp.numericals.com/file[1-100].txt ftp://ftp.numericals.com/file[001-100].txt    (with leading zeros) ftp://ftp.letters.com/file[a-z].txtNo nesting of the sequences is supported at the moment: http://www.any.org/archive[1996-1999]/volume[1-4]part{a,b,c,index}.htmlYou can specify any amount of URLs on the command line. They will be fetchedin a sequential manner in the specified order.Curl will attempt to re-use connections for multiple file transfers, so thatgetting many files from the same server will not do multiple connects /handshakes. This improves speed. Of course this is only done on filesspecified on a single command line and cannot be used between separate curlinvokes..SH OPTIONS.IP "-a/--append"(FTP) When used in an FTP upload, this will tell curl to append to the targetfile instead of overwriting it. If the file doesn't exist, it will be created.If this option is used twice, the second one will disable append mode again..IP "-A/--user-agent <agent string>"(HTTP)Specify the User-Agent string to send to the HTTP server. Some badly done CGIsfail if its not set to "Mozilla/4.0".  To encode blanks in the string,surround the string with single quote marks.  This can also be set with the-H/--header flag of course.If this option is set more than once, the last one will be the one that'sused..IP "--anyauth"(HTTP) Tells curl to figure out authentication method by itself, and use themost secure one the remote site claims it supports. This is done by firstdoing a request and checking the response-headers, thus inducing an extranetwork round-trip. This is used instead of setting a specific authenticationmethod, which you can do with \fI--digest\fP, \fI--ntlm\fP, and\fI--negotiate\fP. (Added in 7.10.6)If this option is used several times, the following occurrences make nodifference..IP "-b/--cookie <name=data>"(HTTP)Pass the data to the HTTP server as a cookie. It is supposedly thedata previously received from the server in a "Set-Cookie:" line.The data should be in the format "NAME1=VALUE1; NAME2=VALUE2".If no '=' letter is used in the line, it is treated as a filename to use toread previously stored cookie lines from, which should be used in this sessionif they match. Using this method also activates the "cookie parser" which willmake curl record incoming cookies too, which may be handy if you're using thisin combination with the -L/--location option. The file format of the file toread cookies from should be plain HTTP headers or the Netscape/Mozilla cookiefile format..B NOTEthat the file specified with -b/--cookie is only used as input. No cookieswill be stored in the file. To store cookies, use the -c/--cookie-jar optionor you could even save the HTTP headers to a file using -D/--dump-header!If this option is set more than once, the last one will be the one that'sused..IP "-B/--use-ascii"Use ASCII transfer when getting an FTP file or LDAP info. For FTP, this canalso be enforced by using an URL that ends with ";type=A". This option causesdata sent to stdout to be in text mode for win32 systems.If this option is used twice, the second one will disable ASCII usage..IP "--basic"(HTTP) Tells curl to use HTTP Basic authentication. This is the default andthis option is usually pointless, unless you use it to override a previouslyset option that sets a different authentication method (such as \fI--ntlm\fP,\fI--digest\fP and \fI--negotiate\fP). (Added in 7.10.6)If this option is used several times, the following occurrences make nodifference..IP "--ciphers <list of ciphers>"(SSL) Specifies which ciphers to use in the connection. The list of ciphersmust be using valid ciphers. Read up on SSL cipher list details on this URL:.I http://www.openssl.org/docs/apps/ciphers.htmlIf this option is used several times, the last one will override the others..IP "--compressed"(HTTP) Request a compressed response using one of the algorithms libcurlsupports, and return the uncompressed document.  If this option is used andthe server sends an unsupported encoding, Curl will report an error.If this option is used several times, each occurrence will toggle it on/off..IP "--connect-timeout <seconds>"Maximum time in seconds that you allow the connection to the server to take.This only limits the connection phase, once curl has connected this option isof no more use. See also the \fI--max-time\fP option.If this option is used several times, the last one will be used..IP "-c/--cookie-jar <file name>"Specify to which file you want curl to write all cookies after a completedoperation. Curl writes all cookies previously read from a specified file aswell as all cookies received from remote server(s). If no cookies are known,no file will be written. The file will be written using the Netscape cookiefile format. If you set the file name to a single dash, "-", the cookies willbe written to stdout..B NOTEIf the cookie jar can't be created or written to, the whole curl operationwon't fail or even report an error clearly. Using -v will get a warningdisplayed, but that is the only visible feedback you get about this possiblylethal situation.If this option is used several times, the last specfied file name will beused..IP "-C/--continue-at <offset>"Continue/Resume a previous file transfer at the given offset. The given offsetis the exact number of bytes that will be skipped counted from the beginningof the source file before it is transfered to the destination.  If used withuploads, the ftp server command SIZE will not be used by curl.Use "-C -" to tell curl to automatically find out where/how to resume thetransfer. It then uses the given output/input files to figure that out.If this option is used several times, the last one will be used..IP "--create-dirs"When used in conjunction with the -o option, curl will create the necessary local directory hierarchy as needed..IP "--crlf"(FTP) Convert LF to CRLF in upload. Useful for MVS (OS/390).If this option is used twice, the second will again disable crlf converting..IP "-d/--data <data>"(HTTP) Sends the specified data in a POST request to the HTTP server, in a waythat can emulate as if a user has filled in a HTML form and pressed the submitbutton. Note that the data is sent exactly as specified with no extraprocessing (with all newlines cut off).  The data is expected to be\&"url-encoded". This will cause curl to pass the data to the server using thecontent-type application/x-www-form-urlencoded. Compare to -F. If more thanone -d/--data option is used on the same command line, the data piecesspecified will be merged together with a separating &-letter. Thus, using '-dname=daniel -d skill=lousy' would generate a post chunk that looks like\&'name=daniel&skill=lousy'.If you start the data with the letter @, the rest should be a file name toread the data from, or - if you want curl to read the data from stdin.  Thecontents of the file must already be url-encoded. Multiple files can also bespecified. Posting data from a file named 'foobar' would thus be done with\&"--data @foobar".To post data purely binary, you should instead use the --data-binary option.-d/--data is the same as --data-ascii.If this option is used several times, the ones following the first willappend data..IP "--data-ascii <data>"(HTTP) This is an alias for the -d/--data option.If this option is used several times, the ones following the first willappend data..IP "--data-binary <data>"(HTTP) This posts data in a similar manner as --data-ascii does, although whenusing this option the entire context of the posted data is kept as-is. If youwant to post a binary file without the strip-newlines feature of the--data-ascii option, this is for you.If this option is used several times, the ones following the first willappend data..IP "--digest"(HTTP) Enables HTTP Digest authentication. This is a authentication thatprevents the password from being sent over the wire in clear text. Use this incombination with the normal -u/--user option to set user name andpassword. See also \fI--ntlm\fP, \fI--negotiate\fP and \fI--anyauth\fP forrelated options. (Added in curl 7.10.6)If this option is used several times, the following occurrences make nodifference..IP "--disable-eprt"(FTP) Tell curl to disable the use of the EPRT and LPRT commands when doingactive FTP transfers. Curl will normally always first attempt to use EPRT,then LPRT before using PORT, but with this option, it will use PORT rightaway. EPRT and LPRT are extensions to the original FTP protocol, may not workon all servers but enable more functionality in a better way than thetraditional PORT command. (Aded in 7.10.5)If this option is used several times, each occurrence will toggle this on/off..IP "--disable-epsv"(FTP) Tell curl to disable the use of the EPSV command when doing passive FTPtransfers. Curl will normally always first attempt to use EPSV before PASV,but with this option, it will not try using EPSV.If this option is used several times, each occurrence will toggle this on/off..IP "-D/--dump-header <file>"Write the protocol headers to the specified file.This option is handy to use when you want to store the headers that a HTTPsite sends to you. Cookies from the headers could then be read in a secondcurl invoke by using the -b/--cookie option! The -c/--cookie-jar option ishowever a better way to store cookies.When used on FTP, the ftp server response lines are considered being "headers"and thus are saved there.If this option is used several times, the last one will be used..IP "-e/--referer <URL>"(HTTP) Sends the "Referer Page" information to the HTTP server. This can alsobe set with the -H/--header flag of course.  When used with.I -L/--location you can append ";auto" to the referer URL to make curl automatically set theprevious URL when it follows a Location: header. The ";auto" string can beused alone, even if you don't set an initial referer.If this option is used several times, the last one will be used..IP "--environment"(RISC OS ONLY) Sets a range of environment variables, using the names the -woption supports, to easier allow extraction of useful information after havingrun curl.If this option is used several times, each occurrence will toggle this on/off..IP "--egd-file <file>"(HTTPS) Specify the path name to the Entropy Gathering Daemon socket. Thesocket is used to seed the random engine for SSL connections. See also the.I "--random-file"option..IP "-E/--cert <certificate[:password]>"(HTTPS)Tells curl to use the specified certificate file when getting a filewith HTTPS. The certificate must be in PEM format.If the optional password isn't specified, it will be queried for onthe terminal. Note that this certificate is the private key and the privatecertificate concatenated!If this option is used several times, the last one will be used..IP "--cacert <CA certificate>"(HTTPS) Tells curl to use the specified certificate file to verify thepeer. The file may contain multiple CA certificates. The certificate(s) mustbe in PEM format.curl recognizes the environment variable named 'CURL_CA_BUNDLE' if that isset, and uses the given path as a path to a CA cert bundle. This optionoverrides that variable.The windows version of curl will automatically look for a CA certs file named\'curl-ca-bundle.crt\', either in the same directory as curl.exe, or in theCurrent Working Directory, or in any folder along your PATH.If this option is used several times, the last one will be used..IP "--capath <CA certificate directory>"(HTTPS) Tells curl to use the specified certificate directory to verify thepeer. The certificates must be in PEM format, and the directory must have beenprocessed using the c_rehash utility supplied with openssl. Using --capath canallow curl to make https connections much more efficiently than using --cacertif the --cacert file contains many CA certificates.If this option is used several times, the last one will be used..IP "-f/--fail"(HTTP) Fail silently (no output at all) on server errors. This is mostly donelike this to better enable scripts etc to better deal with failed attempts. Innormal cases when a HTTP server fails to deliver a document, it returns a HTMLdocument stating so (which often also describes why and more). This flag willprevent curl from outputting that and fail silently instead.If this option is used twice, the second will again disable silent failure..IP "--ftp-create-dirs"(FTP) When an FTP URL/operation uses a path that doesn't currently exist onthe server, the standard behaviour of curl is to fail. Using this option, curlwill instead attempt to create missing directories. (Added in 7.10.7)If this option is used twice, the second will again disable silent failure..IP "-F/--form <name=content>"(HTTP) This lets curl emulate a filled in form in which a user has pressed thesubmit button. This causes curl to POST data using the content-typemultipart/form-data according to RFC1867. This enables uploading of binaryfiles etc. To force the 'content' part to be be a file, prefix the file namewith an @ sign. To just get the content part from a file, prefix the file namewith the letter <. The difference between @ and < is then that @ makes a fileget attached in the post as a file upload, while the < makes a text field andjust get the contents for that text field from a file.Example, to send your password file to the server, where\&'password' is the name of the form-field to which /etc/passwd will be theinput:\fBcurl\fP -F password=@/etc/passwd www.mypasswords.comTo read the file's content from stdin insted of a file, use - where the filename should've been. This goes for both @ and < constructs.You can also tell curl what Content-Type to use for the file upload part, byusing 'type=', in a manner similar to:\fBcurl\fP -F "web=@index.html;type=text/html" url.comSee further examples and details in the MANUAL.This option can be used multiple times..IP "-g/--globoff"This option switches off the "URL globbing parser". When you set this option,you can specify URLs that contain the letters {}[] without having them beinginterpreted by curl itself. Note that these letters are not normal legal URLcontents but they should be encoded according to the URI standard..IP "-G/--get"When used, this option will make all data specified with -d/--data or--data-binary to be used in a HTTP GET request instead of the POST requestthat otherwise would be used. The data will be appended to the URL with a '?'separator.If used in combination with -I, the POST data will instead be appended to theURL with a HEAD request.If used multiple times, nothing special happens..IP "-h/--help"Usage help..IP "-H/--header <header>"(HTTP) Extra header to use when getting a web page. You may specify any numberof extra headers. Note that if you should add a custom header that has thesame name as one of the internal ones curl would use, your externally setheader will be used instead of the internal one. This allows you to make eventrickier stuff than curl would normally do. You should not replace internallyset headers without knowing perfectly well what you're doing. Replacing aninternal header with one without content on the right side of the colon willprevent that header from appearing.This option can be used multiple times to add/replace/remove multiple headers..IP "-i/--include"(HTTP)Include the HTTP-header in the output. The HTTP-header includes thingslike server-name, date of the document, HTTP-version and more...If this option is used twice, the second will again disable header include..IP "--interface <name>"Perform an operation using a specified interface. You can enter interfacename, IP address or host name. An example could look like:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -