php-doc-en/reference/curl/functions/curl-init.xml

75 lines
2.1 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- 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>
<type>resource</type><methodname>curl_init</methodname>
<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
// 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>
<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
-->