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

📄 curl_easy_setopt.3

📁 功能最强大的网络爬虫,希望大家好好学习啊,好好研究啊
💻 3
📖 第 1 页 / 共 5 页
字号:
existing for this "session" only..IP CURLOPT_COOKIELISTPass a char * to a cookie string. Cookie can be either in Netscape / Mozillaformat or just regular HTTP-style header (Set-Cookie: ...) format. If cURLcookie engine was not enabled it will enable its cookie engine.  Passing amagic string \&"ALL" will erase all cookies known by cURL. (Added in 7.14.1)Passing the special string \&"SESS" will only erase all session cookies knownby cURL. (Added in 7.15.4).IP CURLOPT_HTTPGETPass a long. If the long is non-zero, this forces the HTTP request to get backto GET. usable if a POST, HEAD, PUT or a custom request have been usedpreviously using the same curl handle.When setting \fICURLOPT_HTTPGET\fP to a non-zero value, it will automaticallyset \fICURLOPT_NOBODY\fP to 0 (since 7.14.1)..IP CURLOPT_HTTP_VERSIONPass a long, set to one of the values described below. They force libcurl touse the specific HTTP versions. This is not sensible to do unless you have agood reason..RS.IP CURL_HTTP_VERSION_NONEWe don't care about what version the library uses. libcurl will use whateverit thinks fit..IP CURL_HTTP_VERSION_1_0Enforce HTTP 1.0 requests..IP CURL_HTTP_VERSION_1_1Enforce HTTP 1.1 requests..IP CURLOPT_IGNORE_CONTENT_LENGTHIgnore the Content-Length header. This is useful for Apache 1.x (and similarservers) which will report incorrect content length for files over 2gigabytes. If this option is used, curl will not be able to accurately reportprogress, and will simply stop the download when the server ends theconnection. (added in 7.14.1).RE.SH FTP OPTIONS.IP CURLOPT_FTPPORTPass a pointer to a zero terminated string as parameter. It will be used toget the IP address to use for the ftp PORT instruction. The PORT instructiontells the remote server to connect to our specified IP address. The string maybe a plain IP address, a host name, an network interface name (under Unix) orjust a '-' letter to let the library use your systems default IPaddress. Default FTP operations are passive, and thus won't use PORT.You disable PORT again and go back to using the passive version by settingthis option to NULL..IP CURLOPT_QUOTEPass a pointer to a linked list of FTP commands to pass to the server prior toyour ftp request. This will be done before any other FTP commands are issued(even before the CWD command). The linked list should be a fully valid list of'struct curl_slist' structs properly filled in. Use \fIcurl_slist_append(3)\fPto append strings (commands) to the list, and clear the entire list afterwardswith \fIcurl_slist_free_all(3)\fP. Disable this operation again by setting aNULL to this option..IP CURLOPT_POSTQUOTEPass a pointer to a linked list of FTP commands to pass to the server afteryour ftp transfer request. The linked list should be a fully valid list ofstruct curl_slist structs properly filled in as described for\fICURLOPT_QUOTE\fP. Disable this operation again by setting a NULL to thisoption..IP CURLOPT_PREQUOTEPass a pointer to a linked list of FTP commands to pass to the server afterthe transfer type is set. The linked list should be a fully valid list ofstruct curl_slist structs properly filled in as described for\fICURLOPT_QUOTE\fP. Disable this operation again by setting a NULL to thisoption..IP CURLOPT_FTPLISTONLYA non-zero parameter tells the library to just list the names of an ftpdirectory, instead of doing a full directory listing that would include filesizes, dates etc.This causes an FTP NLST command to be sent.  Beware that some FTP servers listonly files in their response to NLST; they might not include subdirectoriesand symbolic links..IP CURLOPT_FTPAPPENDA non-zero parameter tells the library to append to the remote file instead ofoverwrite it. This is only useful when uploading to an ftp site..IP CURLOPT_FTP_USE_EPRTPass a long. If the value is non-zero, it tells curl to use the EPRT (andLPRT) command when doing active FTP downloads (which is enabled by\fICURLOPT_FTPPORT\fP). Using EPRT means that it will first attempt to useEPRT and then LPRT before using PORT, but if you pass FALSE (zero) to thisoption, it will not try using EPRT or LPRT, only plain PORT. (Added in 7.10.5)If the server is an IPv6 host, this option will have no effect as of 7.12.3..IP CURLOPT_FTP_USE_EPSVPass a long. If the value is non-zero, it tells curl to use the EPSV commandwhen doing passive FTP downloads (which it always does by default). Using EPSVmeans that it will first attempt to use EPSV before using PASV, but if youpass FALSE (zero) to this option, it will not try using EPSV, only plain PASV.If the server is an IPv6 host, this option will have no effect as of 7.12.3..IP CURLOPT_FTP_CREATE_MISSING_DIRSPass a long. If the value is non-zero, curl will attempt to create any remotedirectory that it fails to CWD into. CWD is the command that changes workingdirectory. (Added in 7.10.7).IP CURLOPT_FTP_RESPONSE_TIMEOUTPass a long.  Causes curl to set a timeout period (in seconds) on the amountof time that the server is allowed to take in order to generate a responsemessage for a command before the session is considered hung.  While curl iswaiting for a response, this value overrides \fICURLOPT_TIMEOUT\fP. It isrecommended that if used in conjunction with \fICURLOPT_TIMEOUT\fP, you set\fICURLOPT_FTP_RESPONSE_TIMEOUT\fP to a value smaller than\fICURLOPT_TIMEOUT\fP.  (Added in 7.10.8).IP CURLOPT_FTP_ALTERNATIVE_TO_USERPass a char * as parameter, pointing to a string which will be used toauthenticate if the usual FTP "USER user" and "PASS password" negotiationfails. This is currently only known to be required when connecting toTumbleweed's Secure Transport FTPS server using client certificates forauthentication. (Added in 7.15.5).IP CURLOPT_FTP_SKIP_PASV_IPPass a long. If set to a non-zero value, it instructs libcurl to not use theIP address the server suggests in its 227-response to libcurl's PASV commandwhen libcurl connects the data connection. Instead libcurl will re-use thesame IP address it already uses for the control connection. But it will usethe port number from the 227-response. (Added in 7.14.2)This option has no effect if PORT, EPRT or EPSV is used instead of PASV..IP CURLOPT_FTP_SSLPass a long using one of the values from below, to make libcurl use yourdesired level of SSL for the ftp transfer. (Added in 7.11.0).RS.IP CURLFTPSSL_NONEDon't attempt to use SSL..IP CURLFTPSSL_TRYTry using SSL, proceed as normal otherwise..IP CURLFTPSSL_CONTROLRequire SSL for the control connection or fail with \fICURLE_FTP_SSL_FAILED\fP..IP CURLFTPSSL_ALLRequire SSL for all communication or fail with \fICURLE_FTP_SSL_FAILED\fP..RE.IP CURLOPT_FTPSSLAUTHPass a long using one of the values from below, to alter how libcurl issues\&"AUTH TLS" or "AUTH SSL" when FTP over SSL is activated (see\fICURLOPT_FTP_SSL\fP). (Added in 7.12.2).RS.IP CURLFTPAUTH_DEFAULTAllow libcurl to decide.IP CURLFTPAUTH_SSLTry "AUTH SSL" first, and only if that fails try "AUTH TLS".IP CURLFTPAUTH_TLSTry "AUTH TLS" first, and only if that fails try "AUTH SSL".RE.IP CURLOPT_SOURCE_URLWhen set, it enables a FTP third party transfer, using the set URL as source,while \fICURLOPT_URL\fP is the target..IP CURLOPT_SOURCE_USERPWDSet "username:password" to use for the source connection when doing FTP thirdparty transfers..IP CURLOPT_SOURCE_QUOTEExactly like \fICURLOPT_QUOTE\fP, but for the source host..IP CURLOPT_SOURCE_PREQUOTEExactly like \fICURLOPT_PREQUOTE\fP, but for the source host..IP CURLOPT_SOURCE_POSTQUOTEExactly like \fICURLOPT_POSTQUOTE\fP, but for the source host..IP CURLOPT_FTP_ACCOUNTPass a pointer to a zero-terminated string (or NULL to disable). When an FTPserver asks for "account data" after user name and password has been provided,this data is sent off using the ACCT command. (Added in 7.13.0).IP CURLOPT_FTP_FILEMETHODPass a long that should have one of the following values. This option controlswhat method libcurl should use to reach a file on a FTP(S) server. Theargument should be one of the following alternatives:.RS.IP CURLFTPMETHOD_MULTICWDlibcurl does a single CWD operation for each path part in the given URL. Fordeep hierarchies this means very many commands. This is how RFC1738 says itshould be done. This is the default but the slowest behavior..IP CURLFTPMETHOD_NOCWDlibcurl does no CWD at all. libcurl will do SIZE, RETR, STOR etc and give afull path to the server for all these commands. This is the fastest behavior..IP CURLFTPMETHOD_SINGLECWDlibcurl does one CWD with the full target directory and then operates on thefile \&"normally" (like in the multicwd case). This is somewhat more standardscompliant than 'nocwd' but without the full penalty of 'multicwd'..RE.SH PROTOCOL OPTIONS.IP CURLOPT_TRANSFERTEXTA non-zero parameter tells the library to use ASCII mode for ftp transfers,instead of the default binary transfer. For win32 systems it does not set thestdout to binary mode. This option can be usable when transferring text databetween systems with different views on certain characters, such as newlinesor similar.libcurl does not do a complete ASCII conversion when doing ASCII transfersover FTP. This is a known limitation/flaw that nobody has rectified. libcurlsimply sets the mode to ascii and performs a standard transfer..IP CURLOPT_CRLFConvert Unix newlines to CRLF newlines on transfers..IP CURLOPT_RANGEPass a char * as parameter, which should contain the specified range youwant. It should be in the format "X-Y", where X or Y may be left out. HTTPtransfers also support several intervals, separated with commas as in\fI"X-Y,N-M"\fP. Using this kind of multiple intervals will cause the HTTPserver to send the response document in pieces (using standard MIME separationtechniques). Pass a NULL to this option to disable the use of ranges..IP CURLOPT_RESUME_FROMPass a long as parameter. It contains the offset in number of bytes that youwant the transfer to start from. Set this option to 0 to make the transferstart from the beginning (effectively disabling resume)..IP CURLOPT_RESUME_FROM_LARGEPass a curl_off_t as parameter. It contains the offset in number of bytes thatyou want the transfer to start from. (Added in 7.11.0).IP CURLOPT_CUSTOMREQUESTPass a pointer to a zero terminated string as parameter. It will be userinstead of GET or HEAD when doing an HTTP request, or instead of LIST or NLSTwhen doing an ftp directory listing. This is useful for doing DELETE or othermore or less obscure HTTP requests. Don't do this at will, make sure yourserver supports the command first.Restore to the internal default by setting this to NULL.Many people have wrongly used this option to replace the entire request withtheir own, including multiple headers and POST contents. While that might workin many cases, it will cause libcurl to send invalid requests and it couldpossibly confuse the remote server badly. Use \fICURLOPT_POST\fP and\fICURLOPT_POSTFIELDS\fP to set POST data. Use \fICURLOPT_HTTPHEADER\fP toreplace or extend the set of headers sent by libcurl. Use\fICURLOPT_HTTP_VERSION\fP to change HTTP version..IP CURLOPT_FILETIMEPass a long. If it is a non-zero value, libcurl will attempt to get themodification date of the remote document in this operation. This requires thatthe remote server sends the time or replies to a time querying command. The\fIcurl_easy_getinfo(3)\fP function with the \fICURLINFO_FILETIME\fP argumentcan be used after a transfer to extract the received time (if any)..IP CURLOPT_NOBODYA non-zero parameter tells the library to not include the body-part in theoutput. This is only relevant for protocols that have separate header and bodyparts. On HTTP(S) servers, this will make libcurl do a HEAD request.To change request to GET, you should use \fICURLOPT_HTTPGET\fP. Change requestto POST with \fICURLOPT_POST\fP etc..IP CURLOPT_INFILESIZEWhen uploading a file to a remote site, this option should be used to telllibcurl what the expected size of the infile is. This value should be passedas a long. See also \fICURLOPT_INFILESIZE_LARGE\fP..IP CURLOPT_INFILESIZE_LARGEWhen uploading a file to a remote site, this option should be used to telllibcurl what the expected size of the infile is.  This value should be passedas a curl_off_t. (Added in 7.11.0).IP CURLOPT_UPLOADA non-zero parameter tells the library to prepare for an upload. The\fICURLOPT_READDATA\fP and \fICURLOPT_INFILESIZEE\fP or\fICURLOPT_INFILESIZE_LARGE\fP are also interesting for uploads. If theprotocol is HTTP, uploading means using the PUT request unless you telllibcurl otherwise.Using PUT with HTTP 1.1 implies the use of a "Expect: 100-continue" header.You can disable this header with \fICURLOPT_HTTPHEADER\fP as usual.If you use PUT to a HTTP 1.1 server, you can upload data without knowing thesize before starting the transfer if you use chunked encoding. You enable thisby adding a header like "Transfer-Encoding: chunked" with\fICURLOPT_HTTPHEADER\fP. With HTTP 1.0 or without chunked transfer, you must

⌨️ 快捷键说明

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