<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.curl.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'function.curl-setopt-array.php',
    1 => 'curl_setopt_array',
    2 => 'Set multiple options for a cURL transfer',
  ),
  'up' => 
  array (
    0 => 'ref.curl.php',
    1 => 'Функції cURL',
  ),
  'prev' => 
  array (
    0 => 'function.curl-setopt.php',
    1 => 'curl_setopt',
  ),
  'next' => 
  array (
    0 => 'function.curl-share-close.php',
    1 => 'curl_share_close',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/curl/functions/curl-setopt-array.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.curl-setopt-array" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">curl_setopt_array</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.1.3, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">curl_setopt_array</span> &mdash; <span class="dc-title">Set multiple options for a cURL transfer</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.curl-setopt-array-description">
  <h3 class="title">Опис</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>curl_setopt_array</strong></span>(<span class="methodparam"><span class="type"><a href="class.curlhandle.php" class="type CurlHandle">CurlHandle</a></span> <code class="parameter">$handle</code></span>, <span class="methodparam"><span class="type"><a href="language.types.array.php" class="type array">array</a></span> <code class="parameter">$options</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   Sets multiple options for a cURL session. This function is
   useful for setting a large number of cURL options without repetitively
   calling <span class="function"><a href="function.curl-setopt.php" class="function">curl_setopt()</a></span>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.curl-setopt-array-parameters">
  <h3 class="title">Параметри</h3>
  <p class="para">
   <dl>
    <dt><code class="parameter">ch</code></dt>
<dd><p class="para">cURL-дескриптор, якого повертає
<span class="function"><a href="function.curl-init.php" class="function">curl_init()</a></span>.</p></dd>
    
     <dt><code class="parameter">options</code></dt>
     <dd>
      <p class="para">
       An <span class="type"><a href="language.types.array.php" class="type array">array</a></span> specifying which options to set and their values.
       The keys should be valid <span class="function"><a href="function.curl-setopt.php" class="function">curl_setopt()</a></span> constants or
       their integer equivalents.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.curl-setopt-array-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   Returns <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> if all options were successfully set. If an option could
   not be successfully set, <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> is immediately returned, ignoring any
   future options in the <code class="parameter">options</code> array.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.curl-setopt-array-changelog">
  <h3 class="title">Журнал змін</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Версія</th>
      <th>Опис</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
 <td>8.0.0</td>
 <td>
  <code class="parameter">handle</code> тепер має бути примірником класу
  <span class="classname"><a href="class.curlhandle.php" class="classname">CurlHandle</a></span>; раніше очікувався <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span>.
 </td>
</tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.curl-setopt-array-examples">
  <h3 class="title">Приклади</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Приклад #1 
     Initializing a new cURL session and fetching a web page
    </strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">// create a new cURL resource<br /></span><span style="color: #0000BB">$ch </span><span style="color: #007700">= </span><span style="color: #0000BB">curl_init</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">// set URL and other appropriate options<br /></span><span style="color: #0000BB">$options </span><span style="color: #007700">= array(</span><span style="color: #0000BB">CURLOPT_URL </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'http://www.example.com/'</span><span style="color: #007700">,<br />                 </span><span style="color: #0000BB">CURLOPT_HEADER </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">false<br />                </span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">curl_setopt_array</span><span style="color: #007700">(</span><span style="color: #0000BB">$ch</span><span style="color: #007700">, </span><span style="color: #0000BB">$options</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// grab URL and pass it to the browser<br /></span><span style="color: #0000BB">curl_exec</span><span style="color: #007700">(</span><span style="color: #0000BB">$ch</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.curl-setopt-array-notes">
  <h3 class="title">Примітки</h3>
  <blockquote class="note"><p><strong class="note">Зауваження</strong>: 
   <p class="para">
    As with <span class="function"><a href="function.curl-setopt.php" class="function">curl_setopt()</a></span>, passing an array to 
    <strong><code><a href="curl.constants.php#constant.curlopt-post">CURLOPT_POST</a></code></strong> will encode the data as 
    <em>multipart/form-data</em>, while passing a 
    URL-encoded string will encode the data as 
    <em>application/x-www-form-urlencoded</em>.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.curl-setopt-array-seealso">
  <h3 class="title">Прогляньте також</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.curl-setopt.php" class="function" rel="rdfs-seeAlso">curl_setopt()</a> - Set an option for a cURL transfer</span></li>
   </ul>
  </p>
 </div>

</div><?php manual_footer($setup); ?>