1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
|
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.curl-setopt" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>curl_setopt</refname>
<refpurpose>Set an option for a cURL transfer</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>curl_setopt</methodname>
<methodparam><type>CurlHandle</type><parameter>handle</parameter></methodparam>
<methodparam><type>int</type><parameter>option</parameter></methodparam>
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<para>
Sets an option on the given cURL session handle.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
&curl.ch.description;
<varlistentry>
<term><parameter>option</parameter></term>
<listitem>
<para>
The <constant>CURLOPT_<replaceable>*</replaceable></constant> option to set.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>value</parameter></term>
<listitem>
<para>
The value to be set on <parameter>option</parameter>.
See the description of the
<constant>CURLOPT_<replaceable>*</replaceable></constant> constants
for details on the type of values each constant expects.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.4.0</entry>
<entry>
<constant>CURLOPT_DNS_USE_GLOBAL_CACHE</constant> no longer has any effect,
and enabling it on thread-safe PHP builds no longer triggers a warning.
</entry>
</row>
&curl.changelog.handle-param;
<row>
<entry>7.3.15, 7.4.3</entry>
<entry>
Introduced <constant>CURLOPT_HTTP09_ALLOWED</constant>.
</entry>
</row>
<row>
<entry>7.3.0</entry>
<entry>
Introduced <constant>CURLOPT_ABSTRACT_UNIX_SOCKET</constant>, <constant>CURLOPT_KEEP_SENDING_ON_ERROR</constant>,
<constant>CURLOPT_PRE_PROXY</constant>, <constant>CURLOPT_PROXY_CAINFO</constant>,
<constant>CURLOPT_PROXY_CAPATH</constant>, <constant>CURLOPT_PROXY_CRLFILE</constant>,
<constant>CURLOPT_PROXY_KEYPASSWD</constant>, <constant>CURLOPT_PROXY_PINNEDPUBLICKEY</constant>,
<constant>CURLOPT_PROXY_SSLCERT</constant>, <constant>CURLOPT_PROXY_SSLCERTTYPE</constant>,
<constant>CURLOPT_PROXY_SSL_CIPHER_LIST</constant>, <constant>CURLOPT_PROXY_SSLKEY</constant>,
<constant>CURLOPT_PROXY_SSLKEYTYPE</constant>, <constant>CURLOPT_PROXY_SSL_OPTIONS</constant>,
<constant>CURLOPT_PROXY_SSL_VERIFYHOST</constant>, <constant>CURLOPT_PROXY_SSL_VERIFYPEER</constant>,
<constant>CURLOPT_PROXY_SSLVERSION</constant>, <constant>CURLOPT_PROXY_TLSAUTH_PASSWORD</constant>,
<constant>CURLOPT_PROXY_TLSAUTH_TYPE</constant>, <constant>CURLOPT_PROXY_TLSAUTH_USERNAME</constant>,
<constant>CURLOPT_SOCKS5_AUTH</constant>, <constant>CURLOPT_SUPPRESS_CONNECT_HEADERS</constant>,
<constant>CURLOPT_DISALLOW_USERNAME_IN_URL</constant>, <constant>CURLOPT_DNS_SHUFFLE_ADDRESSES</constant>,
<constant>CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS</constant>, <constant>CURLOPT_HAPROXYPROTOCOL</constant>,
<constant>CURLOPT_PROXY_TLS13_CIPHERS</constant>, <constant>CURLOPT_SSH_COMPRESSION</constant>,
<constant>CURLOPT_TIMEVALUE_LARGE</constant> and <constant>CURLOPT_TLS13_CIPHERS</constant>.
</entry>
</row>
<row>
<entry>7.0.7</entry>
<entry>
Introduced <constant>CURL_HTTP_VERSION_2</constant>, <constant>CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE</constant>,
<constant>CURL_HTTP_VERSION_2TLS</constant>, <constant>CURL_REDIR_POST_301</constant>,
<constant>CURL_REDIR_POST_302</constant>, <constant>CURL_REDIR_POST_303</constant>,
<constant>CURL_REDIR_POST_ALL</constant>, <constant>CURL_VERSION_KERBEROS5</constant>,
<constant>CURL_VERSION_PSL</constant>, <constant>CURL_VERSION_UNIX_SOCKETS</constant>,
<constant>CURLAUTH_NEGOTIATE</constant>, <constant>CURLAUTH_NTLM_WB</constant>,
<constant>CURLFTP_CREATE_DIR</constant>, <constant>CURLFTP_CREATE_DIR_NONE</constant>,
<constant>CURLFTP_CREATE_DIR_RETRY</constant>, <constant>CURLHEADER_SEPARATE</constant>,
<constant>CURLHEADER_UNIFIED</constant>, <constant>CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE</constant>,
<constant>CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE</constant>, <constant>CURLMOPT_MAX_HOST_CONNECTIONS</constant>,
<constant>CURLMOPT_MAX_PIPELINE_LENGTH</constant>, <constant>CURLMOPT_MAX_TOTAL_CONNECTIONS</constant>,
<constant>CURLOPT_CONNECT_TO</constant>, <constant>CURLOPT_DEFAULT_PROTOCOL</constant>,
<constant>CURLOPT_DNS_INTERFACE</constant>, <constant>CURLOPT_DNS_LOCAL_IP4</constant>,
<constant>CURLOPT_DNS_LOCAL_IP6</constant>, <constant>CURLOPT_EXPECT_100_TIMEOUT_MS</constant>,
<constant>CURLOPT_HEADEROPT</constant>, <constant>CURLOPT_LOGIN_OPTIONS</constant>,
<constant>CURLOPT_PATH_AS_IS</constant>, <constant>CURLOPT_PINNEDPUBLICKEY</constant>,
<constant>CURLOPT_PIPEWAIT</constant>, <constant>CURLOPT_PROXY_SERVICE_NAME</constant>,
<constant>CURLOPT_PROXYHEADER</constant>, <constant>CURLOPT_SASL_IR</constant>,
<constant>CURLOPT_SERVICE_NAME</constant>, <constant>CURLOPT_SSL_ENABLE_ALPN</constant>,
<constant>CURLOPT_SSL_ENABLE_NPN</constant>, <constant>CURLOPT_SSL_FALSESTART</constant>,
<constant>CURLOPT_SSL_VERIFYSTATUS</constant>, <constant>CURLOPT_STREAM_WEIGHT</constant>,
<constant>CURLOPT_TCP_FASTOPEN</constant>, <constant>CURLOPT_TFTP_NO_OPTIONS</constant>,
<constant>CURLOPT_UNIX_SOCKET_PATH</constant>, <constant>CURLOPT_XOAUTH2_BEARER</constant>,
<constant>CURLPROTO_SMB</constant>, <constant>CURLPROTO_SMBS</constant>,
<constant>CURLPROXY_HTTP_1_0</constant>, <constant>CURLSSH_AUTH_AGENT</constant> and
<constant>CURLSSLOPT_NO_REVOKE</constant>.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Initializing a new cURL session and fetching a web page</title>
<programlisting role="php">
<![CDATA[
<?php
// 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, false);
// grab URL and pass it to the browser
curl_exec($ch);
// close cURL resource, and free up system resources
curl_close($ch);
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<note>
<para>
Passing an array to <constant>CURLOPT_POSTFIELDS</constant> will
encode the data as <emphasis>multipart/form-data</emphasis>,
while passing a URL-encoded string will encode the data as
<emphasis>application/x-www-form-urlencoded</emphasis>.
</para>
</note>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>curl_setopt_array</function></member>
<member><classname>CURLFile</classname></member>
<member><classname>CURLStringFile</classname></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
|