2002-04-15 00:12:54 +00:00
<?xml version="1.0" encoding="iso-8859-1"?>
2009-07-11 06:43:42 +00:00
<!-- $Revision$ -->
2007-06-20 22:25:43 +00:00
<refentry xml:id= 'function.curl-getinfo' xmlns= "http://docbook.org/ns/docbook" >
2007-01-16 20:18:05 +00:00
<refnamediv >
<refname > curl_getinfo</refname>
<refpurpose > Get information regarding a specific transfer</refpurpose>
</refnamediv>
2007-01-17 00:14:52 +00:00
<refsect1 role= "description" >
&reftitle.description;
2007-01-16 20:18:05 +00:00
<methodsynopsis >
<type > mixed</type> <methodname > curl_getinfo</methodname>
<methodparam > <type > resource</type> <parameter > ch</parameter> </methodparam>
2009-01-09 17:08:52 +00:00
<methodparam choice= "opt" > <type > int</type> <parameter > opt</parameter> <initializer > 0</initializer> </methodparam>
2007-01-16 20:18:05 +00:00
</methodsynopsis>
<para >
2010-01-03 23:14:44 +00:00
Gets information about the last transfer.
2007-01-17 00:14:52 +00:00
</para>
</refsect1>
<refsect1 role= "parameters" >
&reftitle.parameters;
<para >
<variablelist >
&curl.ch.description;
<varlistentry >
<term > <parameter > opt</parameter> </term>
<listitem >
<para >
2007-02-05 10:09:00 +00:00
This may be one of the following constants:
2007-01-17 00:14:52 +00:00
<itemizedlist >
<listitem >
<simpara >
2007-02-05 10:09:00 +00:00
<constant > CURLINFO_EFFECTIVE_URL</constant> - Last effective URL
2007-01-17 00:14:52 +00:00
</simpara>
</listitem>
<listitem >
<simpara >
2007-02-05 10:09:00 +00:00
<constant > CURLINFO_HTTP_CODE</constant> - Last received HTTP code
2007-01-17 00:14:52 +00:00
</simpara>
</listitem>
<listitem >
<simpara >
2007-02-05 10:09:00 +00:00
<constant > CURLINFO_FILETIME</constant> - Remote time of the retrieved document, if -1 is returned the time of the document is unknown
2007-01-17 00:14:52 +00:00
</simpara>
</listitem>
<listitem >
<simpara >
2007-02-05 10:09:00 +00:00
<constant > CURLINFO_TOTAL_TIME</constant> - Total transaction time in seconds for last transfer
2007-01-17 00:14:52 +00:00
</simpara>
</listitem>
<listitem >
<simpara >
2007-02-05 10:09:00 +00:00
<constant > CURLINFO_NAMELOOKUP_TIME</constant> - Time in seconds until name resolving was complete
2007-01-17 00:14:52 +00:00
</simpara>
</listitem>
<listitem >
<simpara >
2007-02-05 10:09:00 +00:00
<constant > CURLINFO_CONNECT_TIME</constant> - Time in seconds it took to establish the connection
2007-01-17 00:14:52 +00:00
</simpara>
</listitem>
<listitem >
<simpara >
2007-02-05 10:09:00 +00:00
<constant > CURLINFO_PRETRANSFER_TIME</constant> - Time in seconds from start until just before file transfer begins
2007-01-17 00:14:52 +00:00
</simpara>
</listitem>
<listitem >
<simpara >
2007-02-05 10:09:00 +00:00
<constant > CURLINFO_STARTTRANSFER_TIME</constant> - Time in seconds until the first byte is about to be transferred
2007-01-17 00:14:52 +00:00
</simpara>
</listitem>
<listitem >
<simpara >
2007-02-05 10:09:00 +00:00
<constant > CURLINFO_REDIRECT_TIME</constant> - Time in seconds of all redirection steps before final transaction was started
2007-01-17 00:14:52 +00:00
</simpara>
</listitem>
<listitem >
<simpara >
2007-02-05 10:09:00 +00:00
<constant > CURLINFO_SIZE_UPLOAD</constant> - Total number of bytes uploaded
2007-01-17 00:14:52 +00:00
</simpara>
</listitem>
<listitem >
<simpara >
2007-02-05 10:09:00 +00:00
<constant > CURLINFO_SIZE_DOWNLOAD</constant> - Total number of bytes downloaded
2007-01-17 00:14:52 +00:00
</simpara>
</listitem>
<listitem >
<simpara >
2007-02-05 10:09:00 +00:00
<constant > CURLINFO_SPEED_DOWNLOAD</constant> - Average download speed
2007-01-17 00:14:52 +00:00
</simpara>
</listitem>
<listitem >
<simpara >
2007-02-05 10:09:00 +00:00
<constant > CURLINFO_SPEED_UPLOAD</constant> - Average upload speed
2007-01-17 00:14:52 +00:00
</simpara>
</listitem>
<listitem >
<simpara >
2007-02-05 10:09:00 +00:00
<constant > CURLINFO_HEADER_SIZE</constant> - Total size of all headers received
2007-01-17 00:14:52 +00:00
</simpara>
</listitem>
<listitem >
<simpara >
2009-03-23 21:08:01 +00:00
<constant > CURLINFO_HEADER_OUT</constant> - The request string sent
2007-01-17 00:14:52 +00:00
</simpara>
</listitem>
<listitem >
<simpara >
2007-02-05 10:09:00 +00:00
<constant > CURLINFO_REQUEST_SIZE</constant> - Total size of issued requests, currently only for HTTP requests
2007-01-17 00:14:52 +00:00
</simpara>
</listitem>
<listitem >
<simpara >
2009-05-03 12:27:22 +00:00
<constant > CURLINFO_SSL_VERIFYRESULT</constant> - Result of SSL certification verification requested by setting <constant > CURLOPT_SSL_VERIFYPEER</constant>
2007-01-17 00:14:52 +00:00
</simpara>
</listitem>
<listitem >
<simpara >
2009-05-03 12:27:22 +00:00
<constant > CURLINFO_CONTENT_LENGTH_DOWNLOAD</constant> - content-length of download, read from <literal > Content-Length:</literal> field
2007-01-17 00:14:52 +00:00
</simpara>
</listitem>
<listitem >
<simpara >
2007-02-05 10:09:00 +00:00
<constant > CURLINFO_CONTENT_LENGTH_UPLOAD</constant> - Specified size of upload
2007-01-17 00:14:52 +00:00
</simpara>
</listitem>
<listitem >
<simpara >
2009-05-03 12:27:22 +00:00
<constant > CURLINFO_CONTENT_TYPE</constant> - <literal > Content-Type:</literal> of downloaded object, NULL indicates server did not send valid <literal > Content-Type:</literal> header
2007-01-17 00:14:52 +00:00
</simpara>
</listitem>
</itemizedlist>
</para>
</listitem>
</varlistentry>
</variablelist>
2007-01-16 20:18:05 +00:00
</para>
2007-01-17 00:14:52 +00:00
</refsect1>
2007-01-16 20:18:05 +00:00
2007-01-17 00:14:52 +00:00
<refsect1 role= "returnvalues" >
&reftitle.returnvalues;
2007-01-16 20:18:05 +00:00
<para >
2007-01-17 00:14:52 +00:00
If <parameter > opt</parameter> is given, returns its value as a string.
Otherwise, returns an associative array with the following elements
(which correspond to <parameter > opt</parameter> ):
2007-01-16 20:18:05 +00:00
<itemizedlist >
<listitem >
<simpara >
"url"
</simpara>
</listitem>
<listitem >
<simpara >
"content_type"
</simpara>
</listitem>
<listitem >
<simpara >
"http_code"
</simpara>
</listitem>
<listitem >
<simpara >
"header_size"
</simpara>
</listitem>
<listitem >
<simpara >
"request_size"
</simpara>
</listitem>
<listitem >
<simpara >
"filetime"
</simpara>
</listitem>
<listitem >
<simpara >
"ssl_verify_result"
</simpara>
</listitem>
<listitem >
<simpara >
"redirect_count"
</simpara>
</listitem>
<listitem >
<simpara >
"total_time"
</simpara>
</listitem>
<listitem >
<simpara >
"namelookup_time"
</simpara>
</listitem>
<listitem >
<simpara >
"connect_time"
</simpara>
</listitem>
<listitem >
<simpara >
"pretransfer_time"
</simpara>
</listitem>
<listitem >
<simpara >
"size_upload"
</simpara>
</listitem>
<listitem >
<simpara >
"size_download"
</simpara>
</listitem>
<listitem >
<simpara >
"speed_download"
</simpara>
</listitem>
<listitem >
<simpara >
"speed_upload"
</simpara>
</listitem>
<listitem >
<simpara >
"download_content_length"
</simpara>
</listitem>
<listitem >
<simpara >
"upload_content_length"
</simpara>
</listitem>
<listitem >
<simpara >
"starttransfer_time"
</simpara>
</listitem>
<listitem >
<simpara >
"redirect_time"
</simpara>
</listitem>
</itemizedlist>
</para>
</refsect1>
2008-10-01 08:29:12 +00:00
2009-03-23 21:08:01 +00:00
<refsect1 role= "changelog" >
&reftitle.changelog;
<para >
<informaltable >
<tgroup cols= "2" >
<thead >
<row >
<entry > &Version; </entry>
<entry > &Description; </entry>
</row>
</thead>
<tbody >
<row >
<entry > 5.1.3</entry>
<entry >
Introduced <constant > CURLINFO_HEADER_OUT</constant> .
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
2008-10-01 08:29:12 +00:00
<refsect1 role= "examples" >
&reftitle.examples;
<para >
<example >
<title > <function > curl_getinfo</function> example</title>
<programlisting role= "php" >
< ![CDATA[
< ?php
2009-05-01 01:48:10 +00:00
// Create a curl handle
2008-10-01 08:29:12 +00:00
$ch = curl_init('http://www.yahoo.com/');
// Execute
curl_exec($ch);
// Check if any error occured
if(!curl_errno($ch))
{
2009-05-03 12:27:22 +00:00
$info = curl_getinfo($ch);
2008-10-01 08:29:12 +00:00
2009-05-03 12:27:22 +00:00
echo 'Took ' . $info['total_time'] . ' seconds to send a request to ' . $info['url'];
2008-10-01 08:29:12 +00:00
}
// Close handle
curl_close($ch);
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
2007-01-16 20:18:05 +00:00
</refentry>
2002-04-15 00:12:54 +00:00
<!-- 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"
2002-04-15 00:12:54 +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
-->