2010-03-28 22:10:10 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2009-07-11 06:43:42 +00:00
|
|
|
<!-- $Revision$ -->
|
2007-06-20 22:25:43 +00:00
|
|
|
<refentry xml:id="function.curl-setopt-array" xmlns="http://docbook.org/ns/docbook">
|
2006-04-26 03:18:46 +00:00
|
|
|
<refnamediv>
|
|
|
|
<refname>curl_setopt_array</refname>
|
2007-01-17 00:14:52 +00:00
|
|
|
<refpurpose>Set multiple options for a cURL transfer</refpurpose>
|
2006-04-26 03:18:46 +00:00
|
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
|
|
|
<methodsynopsis>
|
|
|
|
<type>bool</type><methodname>curl_setopt_array</methodname>
|
2020-11-25 00:58:58 +00:00
|
|
|
<methodparam><type>CurlHandle</type><parameter>handle</parameter></methodparam>
|
2006-04-26 03:18:46 +00:00
|
|
|
<methodparam><type>array</type><parameter>options</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
2007-01-17 00:14:52 +00:00
|
|
|
Sets multiple options for a cURL session. This function is
|
2018-04-27 13:51:22 +00:00
|
|
|
useful for setting a large number of cURL options without repetitively
|
2006-04-26 03:18:46 +00:00
|
|
|
calling <function>curl_setopt</function>.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
2007-01-17 00:14:52 +00:00
|
|
|
|
2006-04-26 03:18:46 +00:00
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
|
|
|
<para>
|
|
|
|
<variablelist>
|
2007-01-17 00:14:52 +00:00
|
|
|
&curl.ch.description;
|
2006-04-26 03:18:46 +00:00
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>options</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
An <type>array</type> specifying which options to set and their values.
|
|
|
|
The keys should be valid <function>curl_setopt</function> constants or
|
|
|
|
their integer equivalents.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
2007-01-17 00:14:52 +00:00
|
|
|
|
2006-04-26 03:18:46 +00:00
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
|
|
|
<para>
|
|
|
|
Returns &true; if all options were successfully set. If an option could
|
|
|
|
not be successfully set, &false; is immediately returned, ignoring any
|
|
|
|
future options in the <parameter>options</parameter> array.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
2007-01-17 00:14:52 +00:00
|
|
|
|
2020-11-25 00:58:58 +00:00
|
|
|
<refsect1 role="changelog">
|
|
|
|
&reftitle.changelog;
|
|
|
|
<informaltable>
|
|
|
|
<tgroup cols="2">
|
|
|
|
<thead>
|
|
|
|
<row>
|
|
|
|
<entry>&Version;</entry>
|
|
|
|
<entry>&Description;</entry>
|
|
|
|
</row>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
&curl.changelog.handle-param;
|
|
|
|
</tbody>
|
|
|
|
</tgroup>
|
|
|
|
</informaltable>
|
|
|
|
</refsect1>
|
|
|
|
|
2006-04-26 03:18:46 +00:00
|
|
|
<refsect1 role="examples">
|
|
|
|
&reftitle.examples;
|
|
|
|
<para>
|
|
|
|
<example>
|
|
|
|
<title>
|
2007-02-15 09:24:37 +00:00
|
|
|
Initializing a new cURL session and fetching a web page
|
2006-04-26 03:18:46 +00:00
|
|
|
</title>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
2007-01-17 00:14:52 +00:00
|
|
|
// create a new cURL resource
|
2006-04-26 03:18:46 +00:00
|
|
|
$ch = curl_init();
|
|
|
|
|
|
|
|
// set URL and other appropriate options
|
|
|
|
$options = array(CURLOPT_URL => 'http://www.example.com/',
|
|
|
|
CURLOPT_HEADER => false
|
|
|
|
);
|
|
|
|
|
|
|
|
curl_setopt_array($ch, $options);
|
|
|
|
|
|
|
|
// grab URL and pass it to the browser
|
|
|
|
curl_exec($ch);
|
|
|
|
|
2007-01-17 00:14:52 +00:00
|
|
|
// close cURL resource, and free up system resources
|
2006-04-26 03:18:46 +00:00
|
|
|
curl_close($ch);
|
|
|
|
?>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
2007-01-17 00:14:52 +00:00
|
|
|
|
2009-04-27 15:24:03 +00:00
|
|
|
<refsect1 role="notes">
|
|
|
|
&reftitle.notes;
|
|
|
|
<note>
|
|
|
|
<para>
|
2009-04-27 23:07:24 +00:00
|
|
|
As with <function>curl_setopt</function>, passing an array to
|
|
|
|
<constant>CURLOPT_POST</constant> will encode the data as
|
|
|
|
<emphasis>multipart/form-data</emphasis>, while passing a
|
|
|
|
URL-encoded string will encode the data as
|
2009-04-27 15:24:03 +00:00
|
|
|
<emphasis>application/x-www-form-urlencoded</emphasis>.
|
|
|
|
</para>
|
|
|
|
</note>
|
|
|
|
</refsect1>
|
|
|
|
|
2006-04-26 03:18:46 +00:00
|
|
|
<refsect1 role="seealso">
|
|
|
|
&reftitle.seealso;
|
|
|
|
<para>
|
|
|
|
<simplelist>
|
|
|
|
<member><function>curl_setopt</function></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
|
2009-09-25 07:04:39 +00:00
|
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
2006-04-26 03:18:46 +00:00
|
|
|
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
|
|
|
|
-->
|