<?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.10 $ --> <refentry xml:id='function.curl-error' xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>curl_error</refname> <refpurpose>Return a string containing the last error for the current session</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>string</type><methodname>curl_error</methodname> <methodparam><type>resource</type><parameter>ch</parameter></methodparam> </methodsynopsis> <para> Returns a clear text error message for the last cURL operation. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> &curl.ch.description; </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> Returns the error message or <literal>''</literal> (the empty string) if no error occurred. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title><function>curl_error</function> example</title> <programlisting role="php"> <![CDATA[ <?php // Create a curl handle to a non-existing location $ch = curl_init('http://404.php.net/'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); if(curl_exec($ch) === false) { echo 'Curl error: ' . curl_error($ch); } else { echo 'Operation completed without any errors'; } // Close handle curl_close($ch); ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>curl_errno</function></member> <member><link xlink:href="&url.curl.error;">Curl error codes</link></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 -->