<?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.curl-setopt-array"> <refnamediv> <refname>curl_setopt_array</refname> <refpurpose>Set multiple options for a CURL transfer</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>curl_setopt_array</methodname> <methodparam><type>resource</type><parameter>ch</parameter></methodparam> <methodparam><type>array</type><parameter>options</parameter></methodparam> </methodsynopsis> <para> Sets multiple options for a CURL session. This function is useful for setting a large amount of CURL options without repetitively calling <function>curl_setopt</function>. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>ch</parameter></term> <listitem> <para> The CURL session the options should be set for. </para> </listitem> </varlistentry> <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> <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> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title> Initializing a new CURL session and fetching a webpage </title> <programlisting role="php"> <![CDATA[ <?php // create a new CURL resource $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); // close CURL resource, and free up system resources curl_close($ch); ?> ]]> </programlisting> </example> </para> </refsect1> <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 sgml-default-dtd-file:"../../../../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 -->