2002-04-15 00:12:54 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2004-02-27 05:38:22 +00:00
|
|
|
<!-- $Revision: 1.5 $ -->
|
2002-04-15 00:12:54 +00:00
|
|
|
<!-- splitted from ./en/functions/curl.xml, last change in rev 1.1 -->
|
|
|
|
<refentry id="function.curl-init">
|
|
|
|
<refnamediv>
|
|
|
|
<refname>curl_init</refname>
|
|
|
|
<refpurpose>Initialize a CURL session</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
|
|
|
<methodsynopsis>
|
2002-06-15 08:41:36 +00:00
|
|
|
<type>resource</type><methodname>curl_init</methodname>
|
2002-04-15 00:12:54 +00:00
|
|
|
<methodparam choice="opt"><type>string</type><parameter>url</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
|
|
|
The <function>curl_init</function> will initialize a new session
|
|
|
|
and return a CURL handle for use with the
|
|
|
|
<function>curl_setopt</function>, <function>curl_exec</function>,
|
|
|
|
and <function>curl_close</function> functions. If the optional
|
|
|
|
<parameter>url</parameter> parameter is supplied then the
|
|
|
|
CURLOPT_URL option will be set to the value of the parameter.
|
|
|
|
You can manually set this using the
|
|
|
|
<function>curl_setopt</function> function.
|
|
|
|
<example>
|
|
|
|
<title>
|
|
|
|
Initializing a new CURL session and fetching a webpage
|
|
|
|
</title>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
2004-02-27 05:38:22 +00:00
|
|
|
// create a new curl resource
|
2002-04-15 00:12:54 +00:00
|
|
|
$ch = curl_init();
|
|
|
|
|
2004-02-27 05:38:22 +00:00
|
|
|
// set URL and other appropriate options
|
2003-12-15 16:55:22 +00:00
|
|
|
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/");
|
|
|
|
curl_setopt($ch, CURLOPT_HEADER, 0);
|
2002-04-15 00:12:54 +00:00
|
|
|
|
2004-02-27 05:38:22 +00:00
|
|
|
// grab URL and pass it to the browser
|
2003-12-15 16:55:22 +00:00
|
|
|
curl_exec($ch);
|
2002-04-15 00:12:54 +00:00
|
|
|
|
2004-02-27 05:38:22 +00:00
|
|
|
// close curl resource, and free up system resources
|
2003-12-15 16:55:22 +00:00
|
|
|
curl_close($ch);
|
2002-04-15 00:12:54 +00:00
|
|
|
?>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
See also: <function>curl_close</function>,
|
|
|
|
<function>curl_setopt</function>
|
|
|
|
</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
|
|
|
|
-->
|