cvs: phpdoc /en/reference/curl/functions curl-setopt.xml
| From: | Dave Barr | Date: | Thu, 19 Aug 2004 03:24:29 +0000 |
| Subject: | cvs: phpdoc /en/reference/curl/functions curl-setopt.xml | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969363321@lists.php.net to get a copy of this message | ||
dave Wed Aug 18 23:24:29 2004 EDT
Modified files:
/phpdoc/en/reference/curl/functions curl-setopt.xml
Log:
- Change to a new table layout.
http://cvs.php.net/diff.php/phpdoc/en/reference/curl/functions/curl-setopt.xml?r1=1.11&r2=1.12&ty=u Index: phpdoc/en/reference/curl/functions/curl-setopt.xml diff -u phpdoc/en/reference/curl/functions/curl-setopt.xml:1.11 phpdoc/en/reference/curl/functions/curl-setopt.xml:1.12 --- phpdoc/en/reference/curl/functions/curl-setopt.xml:1.11 Fri Aug 6 20:53:26 2004 +++ phpdoc/en/reference/curl/functions/curl-setopt.xml Wed Aug 18 23:24:29 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.11 $ --> +<!-- $Revision: 1.12 $ --> <!-- splitted from ./en/functions/curl.xml, last change in rev 1.1 --> <refentry id="function.curl-setopt"> <refnamediv> @@ -15,757 +15,1056 @@ <methodparam><type>mixed</type><parameter>value</parameter></methodparam> </methodsynopsis> <para> - The <function>curl_setopt</function> function will set options - for a CURL session identified by the <parameter>ch</parameter> - parameter. The <parameter>option</parameter> parameter is the - option you want to set, and the <parameter>value</parameter> is - the value of the option given by the - <parameter>option</parameter>. + Set an option for a CURL session identified by the + <parameter>ch</parameter> parameter. <parameter>option</parameter> + specifies which option to set, and + <parameter>value</parameter> specifies the value for the option given. </para> <para> - The <parameter>value</parameter> should be a long for the - following options (specified in the <parameter>option</parameter> - parameter): - <itemizedlist> - <listitem> - <simpara> - <parameter>CURLOPT_INFILESIZE</parameter>: When you are - uploading a file to a remote site, this option should be used - to tell PHP what the expected size of the infile will be. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_VERBOSE</parameter>: Set this option to a - non-zero value if you want CURL to report everything that is - happening. Writes output to stderr, or the file specified - using <parameter>CURLOPT_STDERR</parameter>. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_HEADER</parameter>: Set this option to a - non-zero value if you want the header to be included in the - output. - </simpara> - </listitem> - <listitem> - <para> - <parameter>CURLOPT_NOPROGRESS</parameter>: Set this option to - a non-zero value if you don't want PHP to display a progress - meter for CURL transfers. - <note> - <simpara> - PHP automatically sets this option to a non-zero parameter, - this should only be changed for debugging purposes. - </simpara> - </note> - </para> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_NOBODY</parameter>: Set this option to a - non-zero value if you don't want the body included with the - output. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_FAILONERROR</parameter>: Set this option to - a non-zero value if you want PHP to fail silently if the HTTP - code returned is greater than 300. The default behavior is - to return the page normally, ignoring the code. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_UPLOAD</parameter>: Set this option to a - non-zero value if you want PHP to prepare for an upload. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_POST</parameter>: Set this option to a - non-zero value if you want PHP to do a regular HTTP POST. - This POST is a normal <literal>application/x-www-form-urlencoded</literal> - kind, most commonly used by HTML forms. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_FTPLISTONLY</parameter>: Set this option to - a non-zero value and PHP will just list the names of an FTP - directory. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_FTPAPPEND</parameter>: Set this option to a - non-zero value and PHP will append to the remote file instead - of overwriting it. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_NETRC</parameter>: Set this option to a - non-zero value and PHP will scan your <filename>~./netrc</filename> - file to find your username and password for the remote site that - you're establishing a connection with. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_FOLLOWLOCATION</parameter>: Set this option - to a non-zero value to follow any "Location: " header that the - server sends as a part of the HTTP header (note this is - recursive, PHP will follow as many "Location: " headers that - it is sent.) - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_PUT</parameter>: Set this option to a non-zero - value to HTTP PUT a file. The file to PUT must be set with - the <parameter>CURLOPT_INFILE</parameter> and - <parameter>CURLOPT_INFILESIZE</parameter>. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_MUTE</parameter>: Set this option to a - non-zero value and PHP will be completely silent with regards - to the CURL functions. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_TIMEOUT</parameter>: Pass a long as a - parameter that contains the maximum time, in seconds, that - you'll allow the CURL functions to take. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_LOW_SPEED_LIMIT</parameter>: Pass a long as - a parameter that contains the transfer speed in bytes per - second that the transfer should be below during - <parameter>CURLOPT_LOW_SPEED_TIME</parameter> seconds for PHP to - consider too slow and abort. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_LOW_SPEED_TIME</parameter>: Pass a long as - a parameter that contains the time in seconds that the - transfer should be below the - <parameter>CURLOPT_LOW_SPEED_LIMIT</parameter> for PHP - to consider it too slow and abort. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_RESUME_FROM</parameter>: Pass a long as a - parameter that contains the offset, in bytes, that you want - the transfer to start from. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_CAINFO</parameter>: Pass a filename of a file - holding one or more certificates to verify the peer with. This only - makes sense when used in combination with the - <parameter>CURLOPT_SSL_VERIFYPEER</parameter> option. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_SSL_VERIFYPEER</parameter>: Pass a long that is set - to a zero value to stop curl from verifying the peer's certificate - (curl 7.10 starting setting this option to &true; by default). - Alternate certificates to verify against can be specified with the - <parameter>CURLOPT_CAINFO</parameter> option (added in curl 7.9.8) - or a certificate directory can be specified with the <parameter> - CURLOPT_CAPATH</parameter> option. As of curl 7.10, curl installs a - default bundle. <parameter>CURLOPT_SSL_VERIFYHOST</parameter> may - also need to be set to 1 or 0 if <parameter>CURLOPT_SSL_VERIFYPEER - </parameter> is disabled (it defaults to 2). - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_SSLVERSION</parameter>: Pass a long as a - parameter that contains the SSL version (2 or 3) to use. By - default PHP will try and determine this by itself, although, - in some cases you must set this manually. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_SSL_VERIFYHOST</parameter>: Pass a long if - CURL should verify the Common name of the peer certificate in the - SSL handshake. A value of 1 denotes that we should check for the - existence of the common name, a value of 2 denotes that we should - make sure it matches the provided hostname. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_TIMECONDITION</parameter>: Pass a long as a - parameter that defines how the - <parameter>CURLOPT_TIMEVALUE</parameter> is treated. - You can set this parameter to TIMECOND_IFMODSINCE or - TIMECOND_ISUNMODSINCE. This is a HTTP-only feature. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_TIMEVALUE</parameter>: Pass a long as a - parameter that is the time in seconds since January 1st, 1970. - The time will be used as specified by the - <parameter>CURLOPT_TIMECONDITION</parameter> - option, or by default the TIMECOND_IFMODSINCE will be used. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_RETURNTRANSFER</parameter>: Set this option to a - non-zero value if you want CURL to directly return the transfer - instead of printing it out directly. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_NOSIGNAL</parameter>: Set this option to a non-zero - value if you want CURL to ignore any CURL function that causes a - signal to be sent to the PHP process. This is turned on by default in - multi-threaded SAPIs so timeout options can still be used. Added - in CURL 7.10. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_DNS_USE_GLOBAL_CACHE</parameter>: Set this option - to a non-zero value if you want CURL to use a global DNS cache. This - option is not thread-safe and is turned on by default. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_DNS_CACHE_TIMEOUT</parameter>: Pass a long as a - parameter that is the amount of seconds CURL should keep DNS entries - in memory. This option is set to 120 (2 minutes) by default. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_PORT</parameter>: Pass a long as a - parameter specifying the port number to connect to, instead of the - default for the protocol used. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_TRANSFERTEXT</parameter>: Set this option to a - non-zero value if you want CURL to use ASCII mode for FTP transfers. - For LDAP, it retrieves data in plain text instead of HTML. On Windows - systems, stdout will not be set to binary mode. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_FTPASCII</parameter>: An alias of - <parameter>CURLOPT_TRANSFERTEXT</parameter>. Use that instead. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_FTP_USE_EPSV</parameter>: Set this option to a - non-zero value if you want CURL to first try an EPSV command for FTP - transfers before reverting back to PASV. Set this option to zero to - disable EPSV. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_HTTPPROXYTUNNEL</parameter>: Set this option to a - non-zero value to tunnel through a given HTTP proxy. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_FILETIME</parameter>: Set this option to a non-zero - value for CURL to attempt to retrieve the modification date of the - remote document. You can then retrieve this value using the - <parameter>CURLINFO_FILETIME</parameter> option with - <function>curl_getinfo</function>. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_MAXREDIRS</parameter>: Pass a long as a value that - defines the maximum amount of HTTP redirections to follow. Use this - option alongside <parameter>CURLOPT_FOLLOWLOCATION</parameter>. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_MAXCONNECTS</parameter>: Pass a long as a value that - defines the maximum amount of persistent connections that are allowed. - When the limit is reached, <parameter>CURLOPT_CLOSEPOLICY</parameter> - is used to figure out which connection to close. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_CLOSEPOLICY</parameter>: Set this option to either - <parameter>CURLCLOSEPOLICY_LEAST_RECENTLY_USED</parameter> or - <parameter>CURLCLOSEPOLICY_OLDEST</parameter>. - There are three other <parameter>CURLCLOSEPOLICY_</parameter> - constants, but CURL does not support them yet. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_FRESH_CONNECT</parameter>: Set this option to a - non-zero value to force the use of a new connection instead of a - cached one. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_FORBID_REUSE</parameter>: Set this option to a - non-zero value to force the connection to explicitly close when its - finished processing, and not be pooled for reuse. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_CONNECTTIMEOUT</parameter>: Pass a long as a value - that defines the number of seconds to wait whilst trying to connect. - Use zero to wait indefinitely. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_BINARYTRANSFER</parameter>: Set this option to a - non-zero value to return the raw output when - <parameter>CURLOPT_RETURNTRANSFER</parameter> is used. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_PROXYTYPE</parameter>: Set this option to either - <parameter>CURLPROXY_HTTP</parameter> (default) or - <parameter>CURLPROXY_SOCKS5</parameter>. This was added in CURL 7.10. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_BUFFERSIZE</parameter>: Pass a long as a value - that defines the size of the buffer to use for each read. There is no - guarantee this request will be fulfilled, however. This was added - in CURL 7.10. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_HTTPGET</parameter>: Set this option to a non-zero - value to reset the HTTP request method to GET. Since GET is the - default, this is only necessary if the request method has been - changed. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_HTTP_VERSION</parameter>: Set this option to - <parameter>CURL_HTTP_VERSION_NONE</parameter> (default, lets CURL - decide which version to use), - <parameter>CURL_HTTP_VERSION_1_0</parameter> (forces HTTP/1.0), - or <parameter>CURL_HTTP_VERSION_1_1</parameter> (forces HTTP/1.1). - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_CRLF</parameter>: Set this option to a non-zero - value if you want to convert Unix newlines to CRLF newlines on - transfers. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_PROXYPORT</parameter>: Pass a long as a value - that defines the port number of the proxy to connect to. This port - number can also be set in <parameter>CURLOPT_PROXY</parameter>. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_UNRESTRICTED_AUTH</parameter>: Set this option to - a non-zero value to keep sending the username and password when - following locations (using - <parameter>CURLOPT_FOLLOWLOCATION</parameter>), even when the - hostname has changed. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_FTP_USE_EPRT</parameter>: Set this option to a - non-zero value to use EPRT (and LPRT) when doing active FTP downloads. - Use zero to disable EPRT and LPRT and use PORT only. - </simpara> - </listitem> - <listitem> - <para> - <parameter>CURLOPT_HTTPAUTH</parameter>: Pass a long as a value that - defines the HTTP authentication method(s) you wish to use. The options - are: <parameter>CURLAUTH_BASIC</parameter>, - <parameter>CURLAUTH_DIGEST</parameter>, - <parameter>CURLAUTH_GSSNEGOTIATE</parameter>, - <parameter>CURLAUTH_NTLM</parameter>, - <parameter>CURLAUTH_ANY</parameter>, and - <parameter>CURLAUTH_ANYSAFE</parameter>. - </para> - <para> - You can use the bitwise <literal>|</literal> (or) operator to combine - more than one method. If you do this, CURL will poll the server to see - what methods it supports and pick the best one. - <parameter>CURLAUTH_ANY</parameter> is an alias for - <literal>CURLAUTH_BASIC | CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE | CURLAUTH_NTLM</literal> - and <parameter>CURLAUTH_ANYSAFE</parameter> is an alias for - <literal>CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE | CURLAUTH_NTLM</literal>. - </para> - </listitem> - </itemizedlist> + <parameter>value</parameter> should be a bool for the + following values of the <parameter>option</parameter> parameter: + <informaltable> + <tgroup cols="3"> + <thead> + <row> + <entry>Option</entry> + <entry>Set <parameter>value</parameter> to</entry> + <entry>Changed</entry> + </row> + </thead> + <tbody> + <row> + <entry>CURLOPT_BINARYTRANSFER</entry> + <entry> + &true; to return the raw output when + <parameter>CURLOPT_RETURNTRANSFER</parameter> is used. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_CRLF</entry> + <entry> + &true; to convert Unix newlines to CRLF newlines + on transfers. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_DNS_USE_GLOBAL_CACHE</entry> + <entry> + &true; to use a global DNS cache. This option is + not thread-safe and is enabled by default. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_FAILONERROR</entry> + <entry> + &true; to fail silently if the HTTP code returned + is greater than 300. The default behavior is to return the page + normally, ignoring the code. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_FILETIME</entry> + <entry> + &true; to attempt to retrieve the modification + date of the remote document. You can then retrieve this value using + the <parameter>CURLINFO_FILETIME</parameter> option with + <function>curl_getinfo</function>. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_FOLLOWLOCATION</entry> + <entry> + &true; to follow any + <literal>"Location: "</literal> header that the server sends as + part of the HTTP header (note this is recursive, PHP will follow as + many <literal>"Location: "</literal> headers that it is sent, + unless <parameter>CURLOPT_MAXREDIRS</parameter> is set). + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_FORBID_REUSE</entry> + <entry> + &true; to force the connection to explicitly + close when it has finished processing, and not be pooled for reuse. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_FRESH_CONNECT</entry> + <entry> + &true; to force the use of a new connection + instead of a cached one. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_FTP_USE_EPRT</entry> + <entry> + &true; to use EPRT (and LPRT) when doing active + FTP downloads. Use &false; to disable EPRT and LPRT and use PORT + only. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_FTP_USE_EPSV</entry> + <entry> + &true; to first try an EPSV command for FTP + transfers before reverting back to PASV. Set to &false; + to disable EPSV. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_FTPAPPEND</entry> + <entry> + &true; to append to the remote file instead of + overwriting it. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_FTPASCII</entry> + <entry> + An alias of + <parameter>CURLOPT_TRANSFERTEXT</parameter>. Use that instead. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_FTPLISTONLY</entry> + <entry> + &true; to only list the names of an FTP + directory. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_HEADER</entry> + <entry> + &true; to include the header in the output. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_HTTPGET</entry> + <entry> + &true; to reset the HTTP request method to GET. + Since GET is the default, this is only necessary if the request + method has been changed. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_HTTPPROXYTUNNEL</entry> + <entry> + &true; to tunnel through a given HTTP proxy. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_MUTE</entry> + <entry> + &true; to be completely silent with regards to + the CURL functions. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_NETRC</entry> + <entry> + &true; to scan your <filename>~/.netrc</filename> + file to find your username and password for the remote site that + you're establishing a connection with. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_NOBODY</entry> + <entry> + &true; to exclude the body from the output. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_NOPROGRESS</entry> + <entry> + &true; to display a progress meter for CURL + transfers. + <note> + <para> + PHP automatically sets this option to &true;, this should only be + changed for debugging purposes. + </para> + </note> + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_NOSIGNAL</entry> + <entry> + &true; to ignore any CURL function that causes a + signal to be sent to the PHP process. This is turned on by default + in multi-threaded SAPIs so timeout options can still be used. + </entry> + <entry> + Added in CURL 7.10. + </entry> + </row> + <row> + <entry>CURLOPT_POST</entry> + <entry> + &true; to do a regular HTTP POST. This POST is the + normal <literal>application/x-www-form-urlencoded</literal> kind, + most commonly used by HTML forms. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_PUT</entry> + <entry> + &true; to HTTP PUT a file. The file to PUT must + be set with <parameter>CURLOPT_INFILE</parameter> and + <parameter>CURLOPT_INFILESIZE</parameter>. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_RETURNTRANSFER</entry> + <entry> + &true; to return the transfer as a string of the + return value of <function>curl_exec</function> instead of outputting + it out directly. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_SSL_VERIFYPEER</entry> + <entry> + &false; to stop CURL from verifying the peer's + certificate. Alternate certificates to verify against can be + specified with the <parameter>CURLOPT_CAINFO</parameter> option + or a certificate directory can be specified with the + <parameter>CURLOPT_CAPATH</parameter> option. + <parameter>CURLOPT_SSL_VERIFYHOST</parameter> may also need to be + &true; or &false; if + <parameter>CURLOPT_SSL_VERIFYPEER</parameter> is disabled (it + defaults to 2). + </entry> + <entry> + &true; by default as of CURL 7.10. Default bundle installed as of + CURL 7.10. + </entry> + </row> + <row> + <entry>CURLOPT_TRANSFERTEXT</entry> + <entry> + &true; to use ASCII mode for FTP transfers. + For LDAP, it retrieves data in plain text instead of HTML. On + Windows systems, it will not set <literal>STDOUT</literal> to binary + mode. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_UNRESTRICTED_AUTH</entry> + <entry> + &true; to keep sending the username and password + when following locations (using + <parameter>CURLOPT_FOLLOWLOCATION</parameter>), even when the + hostname has changed. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_UPLOAD</entry> + <entry> + &true; to prepare for an upload. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_VERBOSE</entry> + <entry> + &true; to output verbose information. Writes + output to <literal>STDERR</literal>, or the file specified using + <parameter>CURLOPT_STDERR</parameter>. + </entry> + <entry> + </entry> + </row> + </tbody> + </tgroup> + </informaltable> </para> <para> - The <parameter>value</parameter> parameter should be a string for - the following values of the <parameter>option</parameter> - parameter: - <itemizedlist> - <listitem> - <simpara> - <parameter>CURLOPT_URL</parameter>: This is the URL that you - want PHP to fetch. You can also set this option when - initializing a session with the <function>curl_init</function> - function. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_USERPWD</parameter>: Pass a string - formatted in the [username]:[password] manner, for PHP to use - for the connection. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_PROXYUSERPWD</parameter>: Pass a string - formatted in the [username]:[password] format for connection - to the HTTP proxy. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_RANGE</parameter>: Pass the specified range - you want. It should be in the "X-Y" format, where X or Y may - be left out. The HTTP transfers also support several - intervals, separated with commas as in X-Y,N-M. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_POSTFIELDS</parameter>: Pass a string - containing the full data to post in an HTTP "POST" operation. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_REFERER</parameter>: Pass a string - containing the "referer" header to be used in an HTTP request. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_USERAGENT</parameter>: Pass a string - containing the "user-agent" header to be used in an HTTP - request. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_FTPPORT</parameter>: Pass a string - containing the value which will be used to get the IP address to use - for the ftp "POST" instruction. The POST instruction tells - the remote server to connect to our specified IP address. The - string may be a plain IP address, a hostname, a network - interface name (under Unix), or just a plain '-' to use the - systems default IP address. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_COOKIE</parameter>: Pass a string - containing the content of the cookie to be set in the HTTP - header. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_SSLCERT</parameter>: Pass a string - containing the filename of PEM formatted certificate. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_SSLCERTPASSWD</parameter>: Pass a string - containing the password required to use the - <parameter>CURLOPT_SSLCERT</parameter> certificate. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_COOKIEFILE</parameter>: Pass a string - containing the name of the file containing the cookie data. - The cookie file can be in Netscape format, or just plain - HTTP-style headers dumped into a file. - </simpara> - </listitem> - <listitem> - <para> - <parameter>CURLOPT_CUSTOMREQUEST</parameter>: Pass a string to - be used instead of <literal>GET</literal> or - <literal>HEAD</literal> when doing an HTTP request. This is - useful for doing <literal>DELETE</literal> or other, more - obscure, HTTP requests. Valid values are things like - <literal>GET</literal>, <literal>POST</literal>, and so on; - i.e. do not enter a whole HTTP request line here. For instance, - entering 'GET /index.html HTTP/1.0\r\n\r\n' would be incorrect. - <note> - <simpara> - Don't do this without making sure your server supports the - command first. - </simpara> - </note> - </para> - </listitem> - <listitem> - <para> - <parameter>CURLOPT_PROXY</parameter>: Give the name of the HTTP - proxy to tunnel requests through. - </para> - </listitem> - <listitem> - <para> - <parameter>CURLOPT_INTERFACE</parameter>: Pass the name of the - outgoing network interface to use. This can be an interface name, - an IP address or a host name. - </para> - </listitem> - <listitem> - <para> - <parameter>CURLOPT_KRB4LEVEL</parameter>: Pass the KRB4 (Kerberos - 4) security level. Any of the following values (in - order from least to most powerful) are valid: 'clear', 'safe', - 'confidential', 'private'. If the string does not match one of - these, then 'private' is used. Setting this Option to - <literal>NULL</literal>, will disable KRB4 security. Currently KRB4 - security only works with FTP transactions. - </para> - </listitem> - <listitem> - <para> - <parameter>CURLOPT_HTTPHEADER</parameter>: Pass an array of HTTP - header fields to set. - </para> - </listitem> - <listitem> - <para> - <parameter>CURLOPT_QUOTE</parameter>: Pass an array of FTP commands - to perform on the server prior to the FTP request. - </para> - </listitem> - <listitem> - <para> - <parameter>CURLOPT_POSTQUOTE</parameter>: Pass an array of FTP - commands to execute on the server, after the FTP request has been - performed. - </para> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_RANDOM_FILE</parameter>: Pass a string that - contains a filename to be used to seed the random number generator - for SSL. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_EGBSOCKET</parameter>: Like - <parameter>CURLOPT_RANDOM_FILE</parameter> except you pass a string - that contains a filename to an Entropy Gathering Daemon socket. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_CAPATH</parameter>: Pass a string that - contains a directory that holds multiple CA certificates. Use this - option alongside <parameter>CURLOPT_SSL_VERIFYPEER</parameter>. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_COOKIEJAR</parameter>: Pass a string that - contains a filename to save all internal cookies to when the - connection closes. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_SSL_CIPHER_LIST</parameter>: Pass a string that - contains a list of ciphers to use for SSL. For example, - <literal>RC4-SHA</literal> and <literal>TLSv1</literal> are valid - cipher lists. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_SSLKEY</parameter>: Pass a string that - contains the filename of your private SSL key. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_SSLKEYTYPE</parameter>: Pass a string that - contains what key type your private SSL key is. Supported key types - are <literal>"PEM"</literal> (default), <literal>"DER"</literal>, - and <literal>"ENG"</literal>. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_SSLKEYPASSWD</parameter>: Pass a string that - contains the secret password to use your private SSL key. - </simpara> - <note> - <simpara> - Since this option contains a sensitive password, remember to keep - the PHP script it is contained within safe. - </simpara> - </note> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_SSLENGINE</parameter>: Pass a string that - contains the identifier for the crypto engine of your private key. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_SSLENGINE_DEFAULT</parameter>: Pass a string that - contains the identifier for the crypto engine used for asymmetric - crypto operations. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_SSLCERTTYPE</parameter>: Pass a string that - contains what format your certificate is in. Supported formats - are <literal>"PEM"</literal> (default), <literal>"DER"</literal>, - and <literal>"ENG"</literal>. This was added in CURL 7.9.3. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_ENCODING</parameter>: Pass a string that - sets the contents of the <literal>Accept-Encoding:</literal> header, - and enables decoding of the response. Supported encodings are - <literal>"identity"</literal>, <literal>"deflate"</literal>, and - <literal>"gzip"</literal>. If an empty string, <literal>""</literal>, - is passed, a header containing all supported encoding types is sent. - </simpara> - </listitem> - <listitem> - <para> - <parameter>CURLOPT_HTTP200ALIASES</parameter>: Pass an array of - strings that will be treated as valid HTTP 200 responses. This was - added in CURL 7.10.3. - </para> - </listitem> - </itemizedlist> + <parameter>value</parameter> should be an integer for the + following values of the <parameter>option</parameter> parameter: + <informaltable> + <tgroup cols="3"> + <thead> + <row> + <entry>Option</entry> + <entry>Set <parameter>value</parameter> to</entry> + <entry>Changed</entry> + </row> + </thead> + <tbody> + <row> + <entry>CURLOPT_BUFFERSIZE</entry> + <entry> + The size of the buffer to use for each read. There is no guarantee + this request will be fulfilled, however. + </entry> + <entry> + Added in CURL 7.10. + </entry> + </row> + <row> + <entry>CURLOPT_CLOSEPOLICY</entry> + <entry> + Either + <parameter>CURLCLOSEPOLICY_LEAST_RECENTLY_USED</parameter> or + <parameter>CURLCLOSEPOLICY_OLDEST</parameter>. + There are three other <literal>CURLCLOSEPOLICY_</literal> + constants, but CURL does not support them yet. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_CONNECTTIMEOUT</entry> + <entry> + The number of seconds to wait whilst trying to connect. Use 0 to + wait indefinitely. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_DNS_CACHE_TIMEOUT</entry> + <entry> + The number of seconds to keep DNS entries in memory. This + option is set to 120 (2 minutes) by default. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_HTTP_VERSION</entry> + <entry> + <parameter>CURL_HTTP_VERSION_NONE</parameter> (default, lets CURL + decide which version to use), + <parameter>CURL_HTTP_VERSION_1_0</parameter> (forces HTTP/1.0), + or <parameter>CURL_HTTP_VERSION_1_1</parameter> (forces HTTP/1.1). + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_HTTPAUTH</entry> + <entry> + <para> + The HTTP authentication method(s) to use. The options are: + <parameter>CURLAUTH_BASIC</parameter>, + <parameter>CURLAUTH_DIGEST</parameter>, + <parameter>CURLAUTH_GSSNEGOTIATE</parameter>, + <parameter>CURLAUTH_NTLM</parameter>, + <parameter>CURLAUTH_ANY</parameter>, and + <parameter>CURLAUTH_ANYSAFE</parameter>. + </para> + <para> + You can use the bitwise <literal>|</literal> (or) operator to combine + more than one method. If you do this, CURL will poll the server to see + what methods it supports and pick the best one. + </para> + <para> + <parameter>CURLAUTH_ANY</parameter> is an alias for + <literal>CURLAUTH_BASIC | CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE | CURLAUTH_NTLM</literal>. + </para> + <para> + <parameter>CURLAUTH_ANYSAFE</parameter> is an alias for + <literal>CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE | CURLAUTH_NTLM</literal>. + </para> + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_INFILESIZE</entry> + <entry> + The expected size, in bytes, of the file when uploading a file to a + remote site. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_LOW_SPEED_LIMIT</entry> + <entry> + The transfer speed, in bytes per second, that the transfer should be + below during <parameter>CURLOPT_LOW_SPEED_TIME</parameter> seconds + for PHP to consider the transfer too slow and abort. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_LOW_SPEED_TIME</entry> + <entry> + The number of seconds the transfer should be below + <parameter>CURLOPT_LOW_SPEED_LIMIT</parameter> for PHP to consider + the transfer too slow and abort. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_MAXCONNECTS</entry> + <entry> + The maximum amount of persistent connections that are allowed. + When the limit is reached, + <parameter>CURLOPT_CLOSEPOLICY</parameter> is used to determine + which connection to close. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_MAXREDIRS</entry> + <entry> + The maximum amount of HTTP redirections to follow. Use this option + alongside <parameter>CURLOPT_FOLLOWLOCATION</parameter>. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_PORT</entry> + <entry> + An alternative port number to connect to. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_PROXYAUTH</entry> + <entry> + The HTTP authentication method(s) to use for the proxy connection. + Use the same bitmasks as described in + <parameter>CURLOPT_HTTPAUTH</parameter>. For proxy authentication, + only <parameter>CURLAUTH_BASIC</parameter> and + <parameter>CURLAUTH_NTLM</parameter> are currently supported. + </entry> + <entry> + Added in CURL 7.10.7 and PHP 5.1.0. + </entry> + </row> + <row> + <entry>CURLOPT_PROXYPORT</entry> + <entry> + The port number of the proxy to connect to. This port number can + also be set in <parameter>CURLOPT_PROXY</parameter>. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_PROXYTYPE</entry> + <entry> + Either <parameter>CURLPROXY_HTTP</parameter> (default) or + <parameter>CURLPROXY_SOCKS5</parameter>. + </entry> + <entry> + Added in CURL 7.10. + </entry> + </row> + <row> + <entry>CURLOPT_RESUME_FROM</entry> + <entry> + The offset, in bytes, to resume a transfer from. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_SSL_VERIFYHOST</entry> + <entry> + 1 to check the existence of a common name in the + SSL peer certificate. 2 to check the existence of + a common name and also verify that it matches the hostname + provided. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_SSLVERSION</entry> + <entry> + The SSL version (2 or 3) to use. By default PHP will try to determine + this itself, although in some cases you must set this manually. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_TIMECONDITION</entry> + <entry> + How <parameter>CURLOPT_TIMEVALUE</parameter> is treated. + Use <parameter>CURL_TIMECOND_IFMODSINCE</parameter> to return the + page only if it has been modified since the time specified in + <parameter>CURLOPT_TIMEVALUE</parameter>. If it hasn't been modified, + a <literal>"304 Not Modified"</literal> header will be returned + assuming <parameter>CURLOPT_HEADER</parameter> is &true;. + Use <parameter>CURL_TIMECOND_ISUNMODSINCE</parameter> for the reverse + effect. <parameter>CURL_TIMECOND_IFMODSINCE</parameter> is the + default. + </entry> + <entry> + Added in PHP 5.1.0. + </entry> + </row> + <row> + <entry>CURLOPT_TIMEOUT</entry> + <entry> + The maximum number of seconds to allow CURL functions to execute. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_TIMEVALUE</entry> + <entry> + The time in seconds since January 1st, 1970. The time will be used + by <parameter>CURLOPT_TIMECONDITION</parameter>. By default, + <parameter>CURL_TIMECOND_IFMODSINCE</parameter> is used. + </entry> + <entry> + </entry> + </row> + </tbody> + </tgroup> + </informaltable> </para> <para> - The following options expect a file descriptor that is obtained - by using the <function>fopen</function> function: - <itemizedlist> - <listitem> - <simpara> - <parameter>CURLOPT_FILE</parameter>: The file where the output - of your transfer should be placed, the default is STDOUT. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_INFILE</parameter>: The file where the - input of your transfer comes from. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_WRITEHEADER</parameter>: The file to write - the header part of the output into. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_STDERR</parameter>: The file to write - errors to instead of stderr. - </simpara> - </listitem> - </itemizedlist> + <parameter>value</parameter> should be a string for the + following values of the <parameter>option</parameter> parameter: + <informaltable> + <tgroup cols="3"> + <thead> + <row> + <entry>Option</entry> + <entry>Set <parameter>value</parameter> to</entry> + <entry>Changed</entry> + </row> + </thead> + <tbody> + <row> + <entry>CURLOPT_CAINFO</entry> + <entry> + The name of a file holding one or more certificates to verify the + peer with. This only makes sense when used in combination with + <parameter>CURLOPT_SSL_VERIFYPEER</parameter>. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_CAPATH</entry> + <entry> + A directory that holds multiple CA certificates. Use this option + alongside <parameter>CURLOPT_SSL_VERIFYPEER</parameter>. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_COOKIE</entry> + <entry> + The contents of the <literal>"Set-Cookie: "</literal> header to be + used in the HTTP request. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_COOKIEFILE</entry> + <entry> + The name of the file containing the cookie data. The cookie file can + be in Netscape format, or just plain HTTP-style headers dumped into + a file. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_COOKIEJAR</entry> + <entry> + The name of a file to save all internal cookies to when the + connection closes. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_CUSTOMREQUEST</entry> + <entry> + A custom request method to use instead of + <literal>"GET"</literal> or <literal>"HEAD"</literal> when doing + a HTTP request. This is useful for doing + <literal>"DELETE"</literal> or other, more obscure HTTP requests. + Valid values are things like <literal>"GET"</literal>, + <literal>"POST"</literal>, <literal>"CONNECT"</literal> and so on; + i.e. Do not enter a whole HTTP request line here. For instance, + entering <literal>"GET /index.html HTTP/1.0\r\n\r\n"</literal> + would be incorrect. + <note> + <para> + Don't do this without making sure your server supports the custom + request method first. + </para> + </note> + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_EGBSOCKET</entry> + <entry> + Like <parameter>CURLOPT_RANDOM_FILE</parameter>, except a filename + to an Entropy Gathering Daemon socket. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_ENCODING</entry> + <entry> + The contents of the <literal>"Accept-Encoding: "</literal> header. + This enables decoding of the response. Supported encodings are + <literal>"identity"</literal>, <literal>"deflate"</literal>, and + <literal>"gzip"</literal>. If an empty string, <literal>""</literal>, + is set, a header containing all supported encoding types is sent. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_FTPPORT</entry> + <entry> + The value which will be used to get the IP address to use + for the FTP "POST" instruction. The "POST" instruction tells + the remote server to connect to our specified IP address. The + string may be a plain IP address, a hostname, a network + interface name (under Unix), or just a plain '-' to use the + systems default IP address. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_INTERFACE</entry> + <entry> + The name of the outgoing network interface to use. This can be an + interface name, an IP address or a host name. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_KRB4LEVEL</entry> + <entry> + The KRB4 (Kerberos 4) security level. Any of the following values + (in order from least to most powerful) are valid: + <literal>"clear"</literal>, + <literal>"safe"</literal>, + <literal>"confidential"</literal>, + <literal>"private".</literal>. + If the string does not match one of these, + <literal>"private"</literal> is used. Setting this option to &null; + will disable KRB4 security. Currently KRB4 security only works + with FTP transactions. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_POSTFIELDS</entry> + <entry> + The full data to post in a HTTP "POST" operation. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_PROXY</entry> + <entry> + The HTTP proxy to tunnel requests through. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_PROXYUSERPWD</entry> + <entry> + A username and password formatted as + <literal>"[username]:[password]"</literal> to use for the + connection to the proxy. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_RANDOM_FILE</entry> + <entry> + A filename to be used to seed the random number generator for SSL. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_RANGE</entry> + <entry> + Range(s) of data to retrieve in the format + <literal>"X-Y"</literal> where X or Y are optional. HTTP transfers + also support several intervals, separated with commas in the format + <literal>"X-Y,N-M"</literal>. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_REFERER</entry> + <entry> + The contents of the <literal>"Referer: "</literal> header to be used + in a HTTP request. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_SSL_CIPHER_LIST</entry> + <entry> + A list of ciphers to use for SSL. For example, + <literal>RC4-SHA</literal> and <literal>TLSv1</literal> are valid + cipher lists. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_SSLCERT</entry> + <entry> + The name of a file containing a PEM formatted certificate. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_SSLCERTPASSWD</entry> + <entry> + The password required to use the + <parameter>CURLOPT_SSLCERT</parameter> certificate. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_SSLCERTTYPE</entry> + <entry> + The format of the certificate. Supported formats are + <literal>"PEM"</literal> (default), <literal>"DER"</literal>, + and <literal>"ENG"</literal>. + </entry> + <entry> + Added in CURL 7.9.3. + </entry> + </row> + <row> + <entry>CURLOPT_SSLENGINE</entry> + <entry> + The identifier for the crypto engine of the private SSL key + specified in <parameter>CURLOPT_SSLKEY</parameter>. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_SSLENGINE_DEFAULT</entry> + <entry> + The identifier for the crypto engine used for asymmetric crypto + operations. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_SSLKEY</entry> + <entry> + The name of a file containing a private SSL key. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_SSLKEYPASSWD</entry> + <entry> + The secret password needed to use the private SSL key specified in + <parameter>CURLOPT_SSLKEY</parameter>. + <note> + <para> + Since this option contains a sensitive password, remember to keep + the PHP script it is contained within safe. + </para> + </note> + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_SSLKEYTYPE</entry> + <entry> + The key type of the private SSL key specified in + <parameter>CURLOPT_SSLKEY</parameter>. Supported key types are + <literal>"PEM"</literal> (default), <literal>"DER"</literal>, + and <literal>"ENG"</literal>. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_URL</entry> + <entry> + The URL to fetch. You can also set this when initializing a + session with <function>curl_init</function>. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_USERAGENT</entry> + <entry> + The contents of the <literal>"User-Agent: "</literal> header to be + used in a HTTP request. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_USERPWD</entry> + <entry> + A username and password formatted as + <literal>"[username]:[password]"</literal> to use for the + connection. + </entry> + <entry> + </entry> + </row> + </tbody> + </tgroup> + </informaltable> </para> <para> - The following options expect a string that is the name of a callback - function: - <itemizedlist> - <listitem> - <simpara> - <parameter>CURLOPT_WRITEFUNCTION</parameter>: Pass the name of a - callback function where the callback function takes two parameters. - The first is the CURL resource, and the second is a string with the - data to be written. Using this callback function, it becomes your - responsibility to write the data. Return the number of bytes written. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_READFUNCTION</parameter>: Pass the name of a - callback function where the callback function takes two parameters. - The first is the CURL resource, and the second is a string with the - data to be read. Using this callback function, it becomes your - responsibility to read the data. Return the number of bytes read. - Return 0 to signal EOF. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_PASSWDFUNCTION</parameter>: Pass the name of a - callback function where the callback function takes three parameters. - The first is the CURL resource, the second is a string containing a - password prompt, and the third is the maximum password length. Return - the string containing the password. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_HEADERFUNCTION</parameter>: Pass the name of a - callback function where the callback function takes two parameters. - The first is the CURL resource, the second is a string with the header - data to be written. Using this callback function, it becomes your - responsibility to write the header data. Return the number of bytes - written. - </simpara> - </listitem> - </itemizedlist> + <parameter>value</parameter> should be an array for the + following values of the <parameter>option</parameter> parameter: + <informaltable> + <tgroup cols="3"> + <thead> + <row> + <entry>Option</entry> + <entry>Set <parameter>value</parameter> to</entry> + <entry>Changed</entry> + </row> + </thead> + <tbody> + <row> + <entry>CURLOPT_HTTP200ALIASES</entry> + <entry> + An array of HTTP 200 responses that will be treated as valid + responses and not as errors. + </entry> + <entry> + Added in CURL 7.10.3. + </entry> + </row> + <row> + <entry>CURLOPT_HTTPHEADER</entry> + <entry> + An array of HTTP header fields to set. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_POSTQUOTE</entry> + <entry> + An array of FTP commands to execute on the server after the FTP + request has been performed. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_QUOTE</entry> + <entry> + An array of FTP commands to execute on the server prior to the FTP + request. + </entry> + <entry> + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + <para> + <parameter>value</parameter> should be a stream resource (using + <function>fopen</function>, for example) for the following values of the + <parameter>option</parameter> parameter: + <informaltable> + <tgroup cols="3"> + <thead> + <row> + <entry>Option</entry> + <entry>Set <parameter>value</parameter> to</entry> + <entry>Changed</entry> + </row> + </thead> + <tbody> + <row> + <entry>CURLOPT_FILE</entry> + <entry> + The file that the transfer should be written to. The default + is <literal>STDOUT</literal> (the browser window). + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_INFILE</entry> + <entry> + The file that the transfer should be read from when uploading. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_STDERR</entry> + <entry> + An alternative location to output errors to instead of + <literal>STDERR</literal>. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_WRITEHEADER</entry> + <entry> + The file that the header part of the transfer is written to. + </entry> + <entry> + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + <para> + <parameter>value</parameter> should be a string that is the name of a valid + callback function for the the following values of the + <parameter>option</parameter> parameter: + <informaltable> + <tgroup cols="3"> + <thead> + <row> + <entry>Option</entry> + <entry>Set <parameter>value</parameter> to</entry> + <entry>Changed</entry> + </row> + </thead> + <tbody> + <row> + <entry>CURLOPT_HEADERFUNCTION</entry> + <entry> + The name of a callback function where the callback function takes + two parameters. The first is the CURL resource, the second is a + string with the header data to be written. Using this callback + function, it becomes your responsibility to write the header data. + Return the number of bytes written. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_PASSWDFUNCTION</entry> + <entry> + The name of a callback function where the callback function takes + three parameters. The first is the CURL resource, the second is a + string containing a password prompt, and the third is the maximum + password length. Return the string containing the password. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_READFUNCTION</entry> + <entry> + The name of a callback function where the callback function takes + two parameters. The first is the CURL resource, and the second is a + string with the data to be read. Using this callback function, it + becomes your responsibility to read the data. Return the number of + bytes read. Return 0 to signal <literal>EOF</literal>. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_WRITEFUNCTION</entry> + <entry> + The name of a callback function where the callback function takes + two parameters. The first is the CURL resource, and the second is a + string with the data to be written. Using this callback function, it + becomes your responsibility to write the data. Must return the exact + number of bytes written or this will fail. + </entry> + <entry> + </entry> + </row> + </tbody> + </tgroup> + </informaltable> </para> <para> <example> @@ -775,17 +1074,17 @@ <programlisting role="php"> <![CDATA[ <?php -// create a new curl resource +// create a new CURL resource $ch = curl_init(); // set URL and other appropriate options curl_setopt($ch, CURLOPT_URL, "http://www.example.com/"); -curl_setopt($ch, CURLOPT_HEADER, 0); +curl_setopt($ch, CURLOPT_HEADER, false); // grab URL and pass it to the browser curl_exec($ch); -// close curl resource, and free up system resources +// close CURL resource, and free up system resources curl_close($ch); ?> ]]>
http://cvs.php.net/diff.php/phpdoc/en/reference/curl/functions/curl-setopt.xml?r1=1.11&r2=1.12&ty=u Index: phpdoc/en/reference/curl/functions/curl-setopt.xml diff -u phpdoc/en/reference/curl/functions/curl-setopt.xml:1.11 phpdoc/en/reference/curl/functions/curl-setopt.xml:1.12 --- phpdoc/en/reference/curl/functions/curl-setopt.xml:1.11 Fri Aug 6 20:53:26 2004 +++ phpdoc/en/reference/curl/functions/curl-setopt.xml Wed Aug 18 23:24:29 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.11 $ --> +<!-- $Revision: 1.12 $ --> <!-- splitted from ./en/functions/curl.xml, last change in rev 1.1 --> <refentry id="function.curl-setopt"> <refnamediv> @@ -15,757 +15,1056 @@ <methodparam><type>mixed</type><parameter>value</parameter></methodparam> </methodsynopsis> <para> - The <function>curl_setopt</function> function will set options - for a CURL session identified by the <parameter>ch</parameter> - parameter. The <parameter>option</parameter> parameter is the - option you want to set, and the <parameter>value</parameter> is - the value of the option given by the - <parameter>option</parameter>. + Set an option for a CURL session identified by the + <parameter>ch</parameter> parameter. <parameter>option</parameter> + specifies which option to set, and + <parameter>value</parameter> specifies the value for the option given. </para> <para> - The <parameter>value</parameter> should be a long for the - following options (specified in the <parameter>option</parameter> - parameter): - <itemizedlist> - <listitem> - <simpara> - <parameter>CURLOPT_INFILESIZE</parameter>: When you are - uploading a file to a remote site, this option should be used - to tell PHP what the expected size of the infile will be. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_VERBOSE</parameter>: Set this option to a - non-zero value if you want CURL to report everything that is - happening. Writes output to stderr, or the file specified - using <parameter>CURLOPT_STDERR</parameter>. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_HEADER</parameter>: Set this option to a - non-zero value if you want the header to be included in the - output. - </simpara> - </listitem> - <listitem> - <para> - <parameter>CURLOPT_NOPROGRESS</parameter>: Set this option to - a non-zero value if you don't want PHP to display a progress - meter for CURL transfers. - <note> - <simpara> - PHP automatically sets this option to a non-zero parameter, - this should only be changed for debugging purposes. - </simpara> - </note> - </para> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_NOBODY</parameter>: Set this option to a - non-zero value if you don't want the body included with the - output. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_FAILONERROR</parameter>: Set this option to - a non-zero value if you want PHP to fail silently if the HTTP - code returned is greater than 300. The default behavior is - to return the page normally, ignoring the code. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_UPLOAD</parameter>: Set this option to a - non-zero value if you want PHP to prepare for an upload. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_POST</parameter>: Set this option to a - non-zero value if you want PHP to do a regular HTTP POST. - This POST is a normal <literal>application/x-www-form-urlencoded</literal> - kind, most commonly used by HTML forms. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_FTPLISTONLY</parameter>: Set this option to - a non-zero value and PHP will just list the names of an FTP - directory. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_FTPAPPEND</parameter>: Set this option to a - non-zero value and PHP will append to the remote file instead - of overwriting it. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_NETRC</parameter>: Set this option to a - non-zero value and PHP will scan your <filename>~./netrc</filename> - file to find your username and password for the remote site that - you're establishing a connection with. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_FOLLOWLOCATION</parameter>: Set this option - to a non-zero value to follow any "Location: " header that the - server sends as a part of the HTTP header (note this is - recursive, PHP will follow as many "Location: " headers that - it is sent.) - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_PUT</parameter>: Set this option to a non-zero - value to HTTP PUT a file. The file to PUT must be set with - the <parameter>CURLOPT_INFILE</parameter> and - <parameter>CURLOPT_INFILESIZE</parameter>. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_MUTE</parameter>: Set this option to a - non-zero value and PHP will be completely silent with regards - to the CURL functions. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_TIMEOUT</parameter>: Pass a long as a - parameter that contains the maximum time, in seconds, that - you'll allow the CURL functions to take. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_LOW_SPEED_LIMIT</parameter>: Pass a long as - a parameter that contains the transfer speed in bytes per - second that the transfer should be below during - <parameter>CURLOPT_LOW_SPEED_TIME</parameter> seconds for PHP to - consider too slow and abort. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_LOW_SPEED_TIME</parameter>: Pass a long as - a parameter that contains the time in seconds that the - transfer should be below the - <parameter>CURLOPT_LOW_SPEED_LIMIT</parameter> for PHP - to consider it too slow and abort. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_RESUME_FROM</parameter>: Pass a long as a - parameter that contains the offset, in bytes, that you want - the transfer to start from. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_CAINFO</parameter>: Pass a filename of a file - holding one or more certificates to verify the peer with. This only - makes sense when used in combination with the - <parameter>CURLOPT_SSL_VERIFYPEER</parameter> option. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_SSL_VERIFYPEER</parameter>: Pass a long that is set - to a zero value to stop curl from verifying the peer's certificate - (curl 7.10 starting setting this option to &true; by default). - Alternate certificates to verify against can be specified with the - <parameter>CURLOPT_CAINFO</parameter> option (added in curl 7.9.8) - or a certificate directory can be specified with the <parameter> - CURLOPT_CAPATH</parameter> option. As of curl 7.10, curl installs a - default bundle. <parameter>CURLOPT_SSL_VERIFYHOST</parameter> may - also need to be set to 1 or 0 if <parameter>CURLOPT_SSL_VERIFYPEER - </parameter> is disabled (it defaults to 2). - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_SSLVERSION</parameter>: Pass a long as a - parameter that contains the SSL version (2 or 3) to use. By - default PHP will try and determine this by itself, although, - in some cases you must set this manually. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_SSL_VERIFYHOST</parameter>: Pass a long if - CURL should verify the Common name of the peer certificate in the - SSL handshake. A value of 1 denotes that we should check for the - existence of the common name, a value of 2 denotes that we should - make sure it matches the provided hostname. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_TIMECONDITION</parameter>: Pass a long as a - parameter that defines how the - <parameter>CURLOPT_TIMEVALUE</parameter> is treated. - You can set this parameter to TIMECOND_IFMODSINCE or - TIMECOND_ISUNMODSINCE. This is a HTTP-only feature. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_TIMEVALUE</parameter>: Pass a long as a - parameter that is the time in seconds since January 1st, 1970. - The time will be used as specified by the - <parameter>CURLOPT_TIMECONDITION</parameter> - option, or by default the TIMECOND_IFMODSINCE will be used. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_RETURNTRANSFER</parameter>: Set this option to a - non-zero value if you want CURL to directly return the transfer - instead of printing it out directly. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_NOSIGNAL</parameter>: Set this option to a non-zero - value if you want CURL to ignore any CURL function that causes a - signal to be sent to the PHP process. This is turned on by default in - multi-threaded SAPIs so timeout options can still be used. Added - in CURL 7.10. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_DNS_USE_GLOBAL_CACHE</parameter>: Set this option - to a non-zero value if you want CURL to use a global DNS cache. This - option is not thread-safe and is turned on by default. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_DNS_CACHE_TIMEOUT</parameter>: Pass a long as a - parameter that is the amount of seconds CURL should keep DNS entries - in memory. This option is set to 120 (2 minutes) by default. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_PORT</parameter>: Pass a long as a - parameter specifying the port number to connect to, instead of the - default for the protocol used. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_TRANSFERTEXT</parameter>: Set this option to a - non-zero value if you want CURL to use ASCII mode for FTP transfers. - For LDAP, it retrieves data in plain text instead of HTML. On Windows - systems, stdout will not be set to binary mode. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_FTPASCII</parameter>: An alias of - <parameter>CURLOPT_TRANSFERTEXT</parameter>. Use that instead. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_FTP_USE_EPSV</parameter>: Set this option to a - non-zero value if you want CURL to first try an EPSV command for FTP - transfers before reverting back to PASV. Set this option to zero to - disable EPSV. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_HTTPPROXYTUNNEL</parameter>: Set this option to a - non-zero value to tunnel through a given HTTP proxy. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_FILETIME</parameter>: Set this option to a non-zero - value for CURL to attempt to retrieve the modification date of the - remote document. You can then retrieve this value using the - <parameter>CURLINFO_FILETIME</parameter> option with - <function>curl_getinfo</function>. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_MAXREDIRS</parameter>: Pass a long as a value that - defines the maximum amount of HTTP redirections to follow. Use this - option alongside <parameter>CURLOPT_FOLLOWLOCATION</parameter>. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_MAXCONNECTS</parameter>: Pass a long as a value that - defines the maximum amount of persistent connections that are allowed. - When the limit is reached, <parameter>CURLOPT_CLOSEPOLICY</parameter> - is used to figure out which connection to close. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_CLOSEPOLICY</parameter>: Set this option to either - <parameter>CURLCLOSEPOLICY_LEAST_RECENTLY_USED</parameter> or - <parameter>CURLCLOSEPOLICY_OLDEST</parameter>. - There are three other <parameter>CURLCLOSEPOLICY_</parameter> - constants, but CURL does not support them yet. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_FRESH_CONNECT</parameter>: Set this option to a - non-zero value to force the use of a new connection instead of a - cached one. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_FORBID_REUSE</parameter>: Set this option to a - non-zero value to force the connection to explicitly close when its - finished processing, and not be pooled for reuse. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_CONNECTTIMEOUT</parameter>: Pass a long as a value - that defines the number of seconds to wait whilst trying to connect. - Use zero to wait indefinitely. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_BINARYTRANSFER</parameter>: Set this option to a - non-zero value to return the raw output when - <parameter>CURLOPT_RETURNTRANSFER</parameter> is used. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_PROXYTYPE</parameter>: Set this option to either - <parameter>CURLPROXY_HTTP</parameter> (default) or - <parameter>CURLPROXY_SOCKS5</parameter>. This was added in CURL 7.10. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_BUFFERSIZE</parameter>: Pass a long as a value - that defines the size of the buffer to use for each read. There is no - guarantee this request will be fulfilled, however. This was added - in CURL 7.10. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_HTTPGET</parameter>: Set this option to a non-zero - value to reset the HTTP request method to GET. Since GET is the - default, this is only necessary if the request method has been - changed. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_HTTP_VERSION</parameter>: Set this option to - <parameter>CURL_HTTP_VERSION_NONE</parameter> (default, lets CURL - decide which version to use), - <parameter>CURL_HTTP_VERSION_1_0</parameter> (forces HTTP/1.0), - or <parameter>CURL_HTTP_VERSION_1_1</parameter> (forces HTTP/1.1). - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_CRLF</parameter>: Set this option to a non-zero - value if you want to convert Unix newlines to CRLF newlines on - transfers. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_PROXYPORT</parameter>: Pass a long as a value - that defines the port number of the proxy to connect to. This port - number can also be set in <parameter>CURLOPT_PROXY</parameter>. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_UNRESTRICTED_AUTH</parameter>: Set this option to - a non-zero value to keep sending the username and password when - following locations (using - <parameter>CURLOPT_FOLLOWLOCATION</parameter>), even when the - hostname has changed. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_FTP_USE_EPRT</parameter>: Set this option to a - non-zero value to use EPRT (and LPRT) when doing active FTP downloads. - Use zero to disable EPRT and LPRT and use PORT only. - </simpara> - </listitem> - <listitem> - <para> - <parameter>CURLOPT_HTTPAUTH</parameter>: Pass a long as a value that - defines the HTTP authentication method(s) you wish to use. The options - are: <parameter>CURLAUTH_BASIC</parameter>, - <parameter>CURLAUTH_DIGEST</parameter>, - <parameter>CURLAUTH_GSSNEGOTIATE</parameter>, - <parameter>CURLAUTH_NTLM</parameter>, - <parameter>CURLAUTH_ANY</parameter>, and - <parameter>CURLAUTH_ANYSAFE</parameter>. - </para> - <para> - You can use the bitwise <literal>|</literal> (or) operator to combine - more than one method. If you do this, CURL will poll the server to see - what methods it supports and pick the best one. - <parameter>CURLAUTH_ANY</parameter> is an alias for - <literal>CURLAUTH_BASIC | CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE | CURLAUTH_NTLM</literal> - and <parameter>CURLAUTH_ANYSAFE</parameter> is an alias for - <literal>CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE | CURLAUTH_NTLM</literal>. - </para> - </listitem> - </itemizedlist> + <parameter>value</parameter> should be a bool for the + following values of the <parameter>option</parameter> parameter: + <informaltable> + <tgroup cols="3"> + <thead> + <row> + <entry>Option</entry> + <entry>Set <parameter>value</parameter> to</entry> + <entry>Changed</entry> + </row> + </thead> + <tbody> + <row> + <entry>CURLOPT_BINARYTRANSFER</entry> + <entry> + &true; to return the raw output when + <parameter>CURLOPT_RETURNTRANSFER</parameter> is used. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_CRLF</entry> + <entry> + &true; to convert Unix newlines to CRLF newlines + on transfers. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_DNS_USE_GLOBAL_CACHE</entry> + <entry> + &true; to use a global DNS cache. This option is + not thread-safe and is enabled by default. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_FAILONERROR</entry> + <entry> + &true; to fail silently if the HTTP code returned + is greater than 300. The default behavior is to return the page + normally, ignoring the code. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_FILETIME</entry> + <entry> + &true; to attempt to retrieve the modification + date of the remote document. You can then retrieve this value using + the <parameter>CURLINFO_FILETIME</parameter> option with + <function>curl_getinfo</function>. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_FOLLOWLOCATION</entry> + <entry> + &true; to follow any + <literal>"Location: "</literal> header that the server sends as + part of the HTTP header (note this is recursive, PHP will follow as + many <literal>"Location: "</literal> headers that it is sent, + unless <parameter>CURLOPT_MAXREDIRS</parameter> is set). + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_FORBID_REUSE</entry> + <entry> + &true; to force the connection to explicitly + close when it has finished processing, and not be pooled for reuse. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_FRESH_CONNECT</entry> + <entry> + &true; to force the use of a new connection + instead of a cached one. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_FTP_USE_EPRT</entry> + <entry> + &true; to use EPRT (and LPRT) when doing active + FTP downloads. Use &false; to disable EPRT and LPRT and use PORT + only. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_FTP_USE_EPSV</entry> + <entry> + &true; to first try an EPSV command for FTP + transfers before reverting back to PASV. Set to &false; + to disable EPSV. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_FTPAPPEND</entry> + <entry> + &true; to append to the remote file instead of + overwriting it. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_FTPASCII</entry> + <entry> + An alias of + <parameter>CURLOPT_TRANSFERTEXT</parameter>. Use that instead. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_FTPLISTONLY</entry> + <entry> + &true; to only list the names of an FTP + directory. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_HEADER</entry> + <entry> + &true; to include the header in the output. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_HTTPGET</entry> + <entry> + &true; to reset the HTTP request method to GET. + Since GET is the default, this is only necessary if the request + method has been changed. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_HTTPPROXYTUNNEL</entry> + <entry> + &true; to tunnel through a given HTTP proxy. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_MUTE</entry> + <entry> + &true; to be completely silent with regards to + the CURL functions. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_NETRC</entry> + <entry> + &true; to scan your <filename>~/.netrc</filename> + file to find your username and password for the remote site that + you're establishing a connection with. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_NOBODY</entry> + <entry> + &true; to exclude the body from the output. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_NOPROGRESS</entry> + <entry> + &true; to display a progress meter for CURL + transfers. + <note> + <para> + PHP automatically sets this option to &true;, this should only be + changed for debugging purposes. + </para> + </note> + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_NOSIGNAL</entry> + <entry> + &true; to ignore any CURL function that causes a + signal to be sent to the PHP process. This is turned on by default + in multi-threaded SAPIs so timeout options can still be used. + </entry> + <entry> + Added in CURL 7.10. + </entry> + </row> + <row> + <entry>CURLOPT_POST</entry> + <entry> + &true; to do a regular HTTP POST. This POST is the + normal <literal>application/x-www-form-urlencoded</literal> kind, + most commonly used by HTML forms. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_PUT</entry> + <entry> + &true; to HTTP PUT a file. The file to PUT must + be set with <parameter>CURLOPT_INFILE</parameter> and + <parameter>CURLOPT_INFILESIZE</parameter>. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_RETURNTRANSFER</entry> + <entry> + &true; to return the transfer as a string of the + return value of <function>curl_exec</function> instead of outputting + it out directly. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_SSL_VERIFYPEER</entry> + <entry> + &false; to stop CURL from verifying the peer's + certificate. Alternate certificates to verify against can be + specified with the <parameter>CURLOPT_CAINFO</parameter> option + or a certificate directory can be specified with the + <parameter>CURLOPT_CAPATH</parameter> option. + <parameter>CURLOPT_SSL_VERIFYHOST</parameter> may also need to be + &true; or &false; if + <parameter>CURLOPT_SSL_VERIFYPEER</parameter> is disabled (it + defaults to 2). + </entry> + <entry> + &true; by default as of CURL 7.10. Default bundle installed as of + CURL 7.10. + </entry> + </row> + <row> + <entry>CURLOPT_TRANSFERTEXT</entry> + <entry> + &true; to use ASCII mode for FTP transfers. + For LDAP, it retrieves data in plain text instead of HTML. On + Windows systems, it will not set <literal>STDOUT</literal> to binary + mode. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_UNRESTRICTED_AUTH</entry> + <entry> + &true; to keep sending the username and password + when following locations (using + <parameter>CURLOPT_FOLLOWLOCATION</parameter>), even when the + hostname has changed. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_UPLOAD</entry> + <entry> + &true; to prepare for an upload. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_VERBOSE</entry> + <entry> + &true; to output verbose information. Writes + output to <literal>STDERR</literal>, or the file specified using + <parameter>CURLOPT_STDERR</parameter>. + </entry> + <entry> + </entry> + </row> + </tbody> + </tgroup> + </informaltable> </para> <para> - The <parameter>value</parameter> parameter should be a string for - the following values of the <parameter>option</parameter> - parameter: - <itemizedlist> - <listitem> - <simpara> - <parameter>CURLOPT_URL</parameter>: This is the URL that you - want PHP to fetch. You can also set this option when - initializing a session with the <function>curl_init</function> - function. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_USERPWD</parameter>: Pass a string - formatted in the [username]:[password] manner, for PHP to use - for the connection. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_PROXYUSERPWD</parameter>: Pass a string - formatted in the [username]:[password] format for connection - to the HTTP proxy. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_RANGE</parameter>: Pass the specified range - you want. It should be in the "X-Y" format, where X or Y may - be left out. The HTTP transfers also support several - intervals, separated with commas as in X-Y,N-M. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_POSTFIELDS</parameter>: Pass a string - containing the full data to post in an HTTP "POST" operation. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_REFERER</parameter>: Pass a string - containing the "referer" header to be used in an HTTP request. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_USERAGENT</parameter>: Pass a string - containing the "user-agent" header to be used in an HTTP - request. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_FTPPORT</parameter>: Pass a string - containing the value which will be used to get the IP address to use - for the ftp "POST" instruction. The POST instruction tells - the remote server to connect to our specified IP address. The - string may be a plain IP address, a hostname, a network - interface name (under Unix), or just a plain '-' to use the - systems default IP address. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_COOKIE</parameter>: Pass a string - containing the content of the cookie to be set in the HTTP - header. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_SSLCERT</parameter>: Pass a string - containing the filename of PEM formatted certificate. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_SSLCERTPASSWD</parameter>: Pass a string - containing the password required to use the - <parameter>CURLOPT_SSLCERT</parameter> certificate. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_COOKIEFILE</parameter>: Pass a string - containing the name of the file containing the cookie data. - The cookie file can be in Netscape format, or just plain - HTTP-style headers dumped into a file. - </simpara> - </listitem> - <listitem> - <para> - <parameter>CURLOPT_CUSTOMREQUEST</parameter>: Pass a string to - be used instead of <literal>GET</literal> or - <literal>HEAD</literal> when doing an HTTP request. This is - useful for doing <literal>DELETE</literal> or other, more - obscure, HTTP requests. Valid values are things like - <literal>GET</literal>, <literal>POST</literal>, and so on; - i.e. do not enter a whole HTTP request line here. For instance, - entering 'GET /index.html HTTP/1.0\r\n\r\n' would be incorrect. - <note> - <simpara> - Don't do this without making sure your server supports the - command first. - </simpara> - </note> - </para> - </listitem> - <listitem> - <para> - <parameter>CURLOPT_PROXY</parameter>: Give the name of the HTTP - proxy to tunnel requests through. - </para> - </listitem> - <listitem> - <para> - <parameter>CURLOPT_INTERFACE</parameter>: Pass the name of the - outgoing network interface to use. This can be an interface name, - an IP address or a host name. - </para> - </listitem> - <listitem> - <para> - <parameter>CURLOPT_KRB4LEVEL</parameter>: Pass the KRB4 (Kerberos - 4) security level. Any of the following values (in - order from least to most powerful) are valid: 'clear', 'safe', - 'confidential', 'private'. If the string does not match one of - these, then 'private' is used. Setting this Option to - <literal>NULL</literal>, will disable KRB4 security. Currently KRB4 - security only works with FTP transactions. - </para> - </listitem> - <listitem> - <para> - <parameter>CURLOPT_HTTPHEADER</parameter>: Pass an array of HTTP - header fields to set. - </para> - </listitem> - <listitem> - <para> - <parameter>CURLOPT_QUOTE</parameter>: Pass an array of FTP commands - to perform on the server prior to the FTP request. - </para> - </listitem> - <listitem> - <para> - <parameter>CURLOPT_POSTQUOTE</parameter>: Pass an array of FTP - commands to execute on the server, after the FTP request has been - performed. - </para> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_RANDOM_FILE</parameter>: Pass a string that - contains a filename to be used to seed the random number generator - for SSL. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_EGBSOCKET</parameter>: Like - <parameter>CURLOPT_RANDOM_FILE</parameter> except you pass a string - that contains a filename to an Entropy Gathering Daemon socket. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_CAPATH</parameter>: Pass a string that - contains a directory that holds multiple CA certificates. Use this - option alongside <parameter>CURLOPT_SSL_VERIFYPEER</parameter>. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_COOKIEJAR</parameter>: Pass a string that - contains a filename to save all internal cookies to when the - connection closes. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_SSL_CIPHER_LIST</parameter>: Pass a string that - contains a list of ciphers to use for SSL. For example, - <literal>RC4-SHA</literal> and <literal>TLSv1</literal> are valid - cipher lists. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_SSLKEY</parameter>: Pass a string that - contains the filename of your private SSL key. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_SSLKEYTYPE</parameter>: Pass a string that - contains what key type your private SSL key is. Supported key types - are <literal>"PEM"</literal> (default), <literal>"DER"</literal>, - and <literal>"ENG"</literal>. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_SSLKEYPASSWD</parameter>: Pass a string that - contains the secret password to use your private SSL key. - </simpara> - <note> - <simpara> - Since this option contains a sensitive password, remember to keep - the PHP script it is contained within safe. - </simpara> - </note> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_SSLENGINE</parameter>: Pass a string that - contains the identifier for the crypto engine of your private key. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_SSLENGINE_DEFAULT</parameter>: Pass a string that - contains the identifier for the crypto engine used for asymmetric - crypto operations. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_SSLCERTTYPE</parameter>: Pass a string that - contains what format your certificate is in. Supported formats - are <literal>"PEM"</literal> (default), <literal>"DER"</literal>, - and <literal>"ENG"</literal>. This was added in CURL 7.9.3. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_ENCODING</parameter>: Pass a string that - sets the contents of the <literal>Accept-Encoding:</literal> header, - and enables decoding of the response. Supported encodings are - <literal>"identity"</literal>, <literal>"deflate"</literal>, and - <literal>"gzip"</literal>. If an empty string, <literal>""</literal>, - is passed, a header containing all supported encoding types is sent. - </simpara> - </listitem> - <listitem> - <para> - <parameter>CURLOPT_HTTP200ALIASES</parameter>: Pass an array of - strings that will be treated as valid HTTP 200 responses. This was - added in CURL 7.10.3. - </para> - </listitem> - </itemizedlist> + <parameter>value</parameter> should be an integer for the + following values of the <parameter>option</parameter> parameter: + <informaltable> + <tgroup cols="3"> + <thead> + <row> + <entry>Option</entry> + <entry>Set <parameter>value</parameter> to</entry> + <entry>Changed</entry> + </row> + </thead> + <tbody> + <row> + <entry>CURLOPT_BUFFERSIZE</entry> + <entry> + The size of the buffer to use for each read. There is no guarantee + this request will be fulfilled, however. + </entry> + <entry> + Added in CURL 7.10. + </entry> + </row> + <row> + <entry>CURLOPT_CLOSEPOLICY</entry> + <entry> + Either + <parameter>CURLCLOSEPOLICY_LEAST_RECENTLY_USED</parameter> or + <parameter>CURLCLOSEPOLICY_OLDEST</parameter>. + There are three other <literal>CURLCLOSEPOLICY_</literal> + constants, but CURL does not support them yet. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_CONNECTTIMEOUT</entry> + <entry> + The number of seconds to wait whilst trying to connect. Use 0 to + wait indefinitely. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_DNS_CACHE_TIMEOUT</entry> + <entry> + The number of seconds to keep DNS entries in memory. This + option is set to 120 (2 minutes) by default. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_HTTP_VERSION</entry> + <entry> + <parameter>CURL_HTTP_VERSION_NONE</parameter> (default, lets CURL + decide which version to use), + <parameter>CURL_HTTP_VERSION_1_0</parameter> (forces HTTP/1.0), + or <parameter>CURL_HTTP_VERSION_1_1</parameter> (forces HTTP/1.1). + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_HTTPAUTH</entry> + <entry> + <para> + The HTTP authentication method(s) to use. The options are: + <parameter>CURLAUTH_BASIC</parameter>, + <parameter>CURLAUTH_DIGEST</parameter>, + <parameter>CURLAUTH_GSSNEGOTIATE</parameter>, + <parameter>CURLAUTH_NTLM</parameter>, + <parameter>CURLAUTH_ANY</parameter>, and + <parameter>CURLAUTH_ANYSAFE</parameter>. + </para> + <para> + You can use the bitwise <literal>|</literal> (or) operator to combine + more than one method. If you do this, CURL will poll the server to see + what methods it supports and pick the best one. + </para> + <para> + <parameter>CURLAUTH_ANY</parameter> is an alias for + <literal>CURLAUTH_BASIC | CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE | CURLAUTH_NTLM</literal>. + </para> + <para> + <parameter>CURLAUTH_ANYSAFE</parameter> is an alias for + <literal>CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE | CURLAUTH_NTLM</literal>. + </para> + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_INFILESIZE</entry> + <entry> + The expected size, in bytes, of the file when uploading a file to a + remote site. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_LOW_SPEED_LIMIT</entry> + <entry> + The transfer speed, in bytes per second, that the transfer should be + below during <parameter>CURLOPT_LOW_SPEED_TIME</parameter> seconds + for PHP to consider the transfer too slow and abort. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_LOW_SPEED_TIME</entry> + <entry> + The number of seconds the transfer should be below + <parameter>CURLOPT_LOW_SPEED_LIMIT</parameter> for PHP to consider + the transfer too slow and abort. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_MAXCONNECTS</entry> + <entry> + The maximum amount of persistent connections that are allowed. + When the limit is reached, + <parameter>CURLOPT_CLOSEPOLICY</parameter> is used to determine + which connection to close. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_MAXREDIRS</entry> + <entry> + The maximum amount of HTTP redirections to follow. Use this option + alongside <parameter>CURLOPT_FOLLOWLOCATION</parameter>. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_PORT</entry> + <entry> + An alternative port number to connect to. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_PROXYAUTH</entry> + <entry> + The HTTP authentication method(s) to use for the proxy connection. + Use the same bitmasks as described in + <parameter>CURLOPT_HTTPAUTH</parameter>. For proxy authentication, + only <parameter>CURLAUTH_BASIC</parameter> and + <parameter>CURLAUTH_NTLM</parameter> are currently supported. + </entry> + <entry> + Added in CURL 7.10.7 and PHP 5.1.0. + </entry> + </row> + <row> + <entry>CURLOPT_PROXYPORT</entry> + <entry> + The port number of the proxy to connect to. This port number can + also be set in <parameter>CURLOPT_PROXY</parameter>. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_PROXYTYPE</entry> + <entry> + Either <parameter>CURLPROXY_HTTP</parameter> (default) or + <parameter>CURLPROXY_SOCKS5</parameter>. + </entry> + <entry> + Added in CURL 7.10. + </entry> + </row> + <row> + <entry>CURLOPT_RESUME_FROM</entry> + <entry> + The offset, in bytes, to resume a transfer from. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_SSL_VERIFYHOST</entry> + <entry> + 1 to check the existence of a common name in the + SSL peer certificate. 2 to check the existence of + a common name and also verify that it matches the hostname + provided. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_SSLVERSION</entry> + <entry> + The SSL version (2 or 3) to use. By default PHP will try to determine + this itself, although in some cases you must set this manually. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_TIMECONDITION</entry> + <entry> + How <parameter>CURLOPT_TIMEVALUE</parameter> is treated. + Use <parameter>CURL_TIMECOND_IFMODSINCE</parameter> to return the + page only if it has been modified since the time specified in + <parameter>CURLOPT_TIMEVALUE</parameter>. If it hasn't been modified, + a <literal>"304 Not Modified"</literal> header will be returned + assuming <parameter>CURLOPT_HEADER</parameter> is &true;. + Use <parameter>CURL_TIMECOND_ISUNMODSINCE</parameter> for the reverse + effect. <parameter>CURL_TIMECOND_IFMODSINCE</parameter> is the + default. + </entry> + <entry> + Added in PHP 5.1.0. + </entry> + </row> + <row> + <entry>CURLOPT_TIMEOUT</entry> + <entry> + The maximum number of seconds to allow CURL functions to execute. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_TIMEVALUE</entry> + <entry> + The time in seconds since January 1st, 1970. The time will be used + by <parameter>CURLOPT_TIMECONDITION</parameter>. By default, + <parameter>CURL_TIMECOND_IFMODSINCE</parameter> is used. + </entry> + <entry> + </entry> + </row> + </tbody> + </tgroup> + </informaltable> </para> <para> - The following options expect a file descriptor that is obtained - by using the <function>fopen</function> function: - <itemizedlist> - <listitem> - <simpara> - <parameter>CURLOPT_FILE</parameter>: The file where the output - of your transfer should be placed, the default is STDOUT. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_INFILE</parameter>: The file where the - input of your transfer comes from. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_WRITEHEADER</parameter>: The file to write - the header part of the output into. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_STDERR</parameter>: The file to write - errors to instead of stderr. - </simpara> - </listitem> - </itemizedlist> + <parameter>value</parameter> should be a string for the + following values of the <parameter>option</parameter> parameter: + <informaltable> + <tgroup cols="3"> + <thead> + <row> + <entry>Option</entry> + <entry>Set <parameter>value</parameter> to</entry> + <entry>Changed</entry> + </row> + </thead> + <tbody> + <row> + <entry>CURLOPT_CAINFO</entry> + <entry> + The name of a file holding one or more certificates to verify the + peer with. This only makes sense when used in combination with + <parameter>CURLOPT_SSL_VERIFYPEER</parameter>. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_CAPATH</entry> + <entry> + A directory that holds multiple CA certificates. Use this option + alongside <parameter>CURLOPT_SSL_VERIFYPEER</parameter>. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_COOKIE</entry> + <entry> + The contents of the <literal>"Set-Cookie: "</literal> header to be + used in the HTTP request. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_COOKIEFILE</entry> + <entry> + The name of the file containing the cookie data. The cookie file can + be in Netscape format, or just plain HTTP-style headers dumped into + a file. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_COOKIEJAR</entry> + <entry> + The name of a file to save all internal cookies to when the + connection closes. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_CUSTOMREQUEST</entry> + <entry> + A custom request method to use instead of + <literal>"GET"</literal> or <literal>"HEAD"</literal> when doing + a HTTP request. This is useful for doing + <literal>"DELETE"</literal> or other, more obscure HTTP requests. + Valid values are things like <literal>"GET"</literal>, + <literal>"POST"</literal>, <literal>"CONNECT"</literal> and so on; + i.e. Do not enter a whole HTTP request line here. For instance, + entering <literal>"GET /index.html HTTP/1.0\r\n\r\n"</literal> + would be incorrect. + <note> + <para> + Don't do this without making sure your server supports the custom + request method first. + </para> + </note> + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_EGBSOCKET</entry> + <entry> + Like <parameter>CURLOPT_RANDOM_FILE</parameter>, except a filename + to an Entropy Gathering Daemon socket. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_ENCODING</entry> + <entry> + The contents of the <literal>"Accept-Encoding: "</literal> header. + This enables decoding of the response. Supported encodings are + <literal>"identity"</literal>, <literal>"deflate"</literal>, and + <literal>"gzip"</literal>. If an empty string, <literal>""</literal>, + is set, a header containing all supported encoding types is sent. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_FTPPORT</entry> + <entry> + The value which will be used to get the IP address to use + for the FTP "POST" instruction. The "POST" instruction tells + the remote server to connect to our specified IP address. The + string may be a plain IP address, a hostname, a network + interface name (under Unix), or just a plain '-' to use the + systems default IP address. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_INTERFACE</entry> + <entry> + The name of the outgoing network interface to use. This can be an + interface name, an IP address or a host name. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_KRB4LEVEL</entry> + <entry> + The KRB4 (Kerberos 4) security level. Any of the following values + (in order from least to most powerful) are valid: + <literal>"clear"</literal>, + <literal>"safe"</literal>, + <literal>"confidential"</literal>, + <literal>"private".</literal>. + If the string does not match one of these, + <literal>"private"</literal> is used. Setting this option to &null; + will disable KRB4 security. Currently KRB4 security only works + with FTP transactions. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_POSTFIELDS</entry> + <entry> + The full data to post in a HTTP "POST" operation. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_PROXY</entry> + <entry> + The HTTP proxy to tunnel requests through. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_PROXYUSERPWD</entry> + <entry> + A username and password formatted as + <literal>"[username]:[password]"</literal> to use for the + connection to the proxy. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_RANDOM_FILE</entry> + <entry> + A filename to be used to seed the random number generator for SSL. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_RANGE</entry> + <entry> + Range(s) of data to retrieve in the format + <literal>"X-Y"</literal> where X or Y are optional. HTTP transfers + also support several intervals, separated with commas in the format + <literal>"X-Y,N-M"</literal>. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_REFERER</entry> + <entry> + The contents of the <literal>"Referer: "</literal> header to be used + in a HTTP request. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_SSL_CIPHER_LIST</entry> + <entry> + A list of ciphers to use for SSL. For example, + <literal>RC4-SHA</literal> and <literal>TLSv1</literal> are valid + cipher lists. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_SSLCERT</entry> + <entry> + The name of a file containing a PEM formatted certificate. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_SSLCERTPASSWD</entry> + <entry> + The password required to use the + <parameter>CURLOPT_SSLCERT</parameter> certificate. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_SSLCERTTYPE</entry> + <entry> + The format of the certificate. Supported formats are + <literal>"PEM"</literal> (default), <literal>"DER"</literal>, + and <literal>"ENG"</literal>. + </entry> + <entry> + Added in CURL 7.9.3. + </entry> + </row> + <row> + <entry>CURLOPT_SSLENGINE</entry> + <entry> + The identifier for the crypto engine of the private SSL key + specified in <parameter>CURLOPT_SSLKEY</parameter>. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_SSLENGINE_DEFAULT</entry> + <entry> + The identifier for the crypto engine used for asymmetric crypto + operations. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_SSLKEY</entry> + <entry> + The name of a file containing a private SSL key. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_SSLKEYPASSWD</entry> + <entry> + The secret password needed to use the private SSL key specified in + <parameter>CURLOPT_SSLKEY</parameter>. + <note> + <para> + Since this option contains a sensitive password, remember to keep + the PHP script it is contained within safe. + </para> + </note> + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_SSLKEYTYPE</entry> + <entry> + The key type of the private SSL key specified in + <parameter>CURLOPT_SSLKEY</parameter>. Supported key types are + <literal>"PEM"</literal> (default), <literal>"DER"</literal>, + and <literal>"ENG"</literal>. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_URL</entry> + <entry> + The URL to fetch. You can also set this when initializing a + session with <function>curl_init</function>. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_USERAGENT</entry> + <entry> + The contents of the <literal>"User-Agent: "</literal> header to be + used in a HTTP request. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_USERPWD</entry> + <entry> + A username and password formatted as + <literal>"[username]:[password]"</literal> to use for the + connection. + </entry> + <entry> + </entry> + </row> + </tbody> + </tgroup> + </informaltable> </para> <para> - The following options expect a string that is the name of a callback - function: - <itemizedlist> - <listitem> - <simpara> - <parameter>CURLOPT_WRITEFUNCTION</parameter>: Pass the name of a - callback function where the callback function takes two parameters. - The first is the CURL resource, and the second is a string with the - data to be written. Using this callback function, it becomes your - responsibility to write the data. Return the number of bytes written. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_READFUNCTION</parameter>: Pass the name of a - callback function where the callback function takes two parameters. - The first is the CURL resource, and the second is a string with the - data to be read. Using this callback function, it becomes your - responsibility to read the data. Return the number of bytes read. - Return 0 to signal EOF. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_PASSWDFUNCTION</parameter>: Pass the name of a - callback function where the callback function takes three parameters. - The first is the CURL resource, the second is a string containing a - password prompt, and the third is the maximum password length. Return - the string containing the password. - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>CURLOPT_HEADERFUNCTION</parameter>: Pass the name of a - callback function where the callback function takes two parameters. - The first is the CURL resource, the second is a string with the header - data to be written. Using this callback function, it becomes your - responsibility to write the header data. Return the number of bytes - written. - </simpara> - </listitem> - </itemizedlist> + <parameter>value</parameter> should be an array for the + following values of the <parameter>option</parameter> parameter: + <informaltable> + <tgroup cols="3"> + <thead> + <row> + <entry>Option</entry> + <entry>Set <parameter>value</parameter> to</entry> + <entry>Changed</entry> + </row> + </thead> + <tbody> + <row> + <entry>CURLOPT_HTTP200ALIASES</entry> + <entry> + An array of HTTP 200 responses that will be treated as valid + responses and not as errors. + </entry> + <entry> + Added in CURL 7.10.3. + </entry> + </row> + <row> + <entry>CURLOPT_HTTPHEADER</entry> + <entry> + An array of HTTP header fields to set. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_POSTQUOTE</entry> + <entry> + An array of FTP commands to execute on the server after the FTP + request has been performed. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_QUOTE</entry> + <entry> + An array of FTP commands to execute on the server prior to the FTP + request. + </entry> + <entry> + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + <para> + <parameter>value</parameter> should be a stream resource (using + <function>fopen</function>, for example) for the following values of the + <parameter>option</parameter> parameter: + <informaltable> + <tgroup cols="3"> + <thead> + <row> + <entry>Option</entry> + <entry>Set <parameter>value</parameter> to</entry> + <entry>Changed</entry> + </row> + </thead> + <tbody> + <row> + <entry>CURLOPT_FILE</entry> + <entry> + The file that the transfer should be written to. The default + is <literal>STDOUT</literal> (the browser window). + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_INFILE</entry> + <entry> + The file that the transfer should be read from when uploading. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_STDERR</entry> + <entry> + An alternative location to output errors to instead of + <literal>STDERR</literal>. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_WRITEHEADER</entry> + <entry> + The file that the header part of the transfer is written to. + </entry> + <entry> + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + <para> + <parameter>value</parameter> should be a string that is the name of a valid + callback function for the the following values of the + <parameter>option</parameter> parameter: + <informaltable> + <tgroup cols="3"> + <thead> + <row> + <entry>Option</entry> + <entry>Set <parameter>value</parameter> to</entry> + <entry>Changed</entry> + </row> + </thead> + <tbody> + <row> + <entry>CURLOPT_HEADERFUNCTION</entry> + <entry> + The name of a callback function where the callback function takes + two parameters. The first is the CURL resource, the second is a + string with the header data to be written. Using this callback + function, it becomes your responsibility to write the header data. + Return the number of bytes written. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_PASSWDFUNCTION</entry> + <entry> + The name of a callback function where the callback function takes + three parameters. The first is the CURL resource, the second is a + string containing a password prompt, and the third is the maximum + password length. Return the string containing the password. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_READFUNCTION</entry> + <entry> + The name of a callback function where the callback function takes + two parameters. The first is the CURL resource, and the second is a + string with the data to be read. Using this callback function, it + becomes your responsibility to read the data. Return the number of + bytes read. Return 0 to signal <literal>EOF</literal>. + </entry> + <entry> + </entry> + </row> + <row> + <entry>CURLOPT_WRITEFUNCTION</entry> + <entry> + The name of a callback function where the callback function takes + two parameters. The first is the CURL resource, and the second is a + string with the data to be written. Using this callback function, it + becomes your responsibility to write the data. Must return the exact + number of bytes written or this will fail. + </entry> + <entry> + </entry> + </row> + </tbody> + </tgroup> + </informaltable> </para> <para> <example> @@ -775,17 +1074,17 @@ <programlisting role="php"> <![CDATA[ <?php -// create a new curl resource +// create a new CURL resource $ch = curl_init(); // set URL and other appropriate options curl_setopt($ch, CURLOPT_URL, "http://www.example.com/"); -curl_setopt($ch, CURLOPT_HEADER, 0); +curl_setopt($ch, CURLOPT_HEADER, false); // grab URL and pass it to the browser curl_exec($ch); -// close curl resource, and free up system resources +// close CURL resource, and free up system resources curl_close($ch); ?> ]]>