<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.curl-exec" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>curl_exec</refname>
  <refpurpose>Perform a cURL session</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type class="union"><type>string</type><type>bool</type></type><methodname>curl_exec</methodname>
   <methodparam><type>CurlHandle</type><parameter>handle</parameter></methodparam>
  </methodsynopsis>
  <para>
   Execute the given cURL session.
  </para>
  <para>
   This function should be called after initializing a cURL session and all
   the options for the session are set. 
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    &curl.ch.description;
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   &return.success; However, if the <constant>CURLOPT_RETURNTRANSFER</constant>
   option is <link linkend="function.curl-setopt">set</link>, it will return
   the result on success, &false; on failure.
  </para>
  &return.falseproblem;
  <note>
   <para>
    Note that response status codes which indicate errors (such as <literal>404
    Not found</literal>) are not regarded as failure.
    <function>curl_getinfo</function> can be used to check for these.
   </para>
  </note>
 </refsect1>
   
 <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>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>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, 0);

// 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_multi_exec</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:"~/.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
-->
