Easy Tutorial
❮ Func Date Date Parse Func Filesystem Fread ❯

PHP curl_init Function

PHP cURL Reference Manual

(PHP 4 >= 4.0.2, PHP 5)

curl_init — Initialize a cURL session


Description

resource curl_init ([ string $url = NULL ] )

Initializes a new session and returns a cURL handle for use with the functions curl_setopt(), curl_exec(), and curl_close().


Parameters

url

If provided, the CURLOPT_URL option will be set to this value. You can also manually set this value using the curl_setopt() function.


Return Value

Returns a cURL handle on success, FALSE on error.


Example

Initialize a new cURL session and fetch a webpage

<?php
// Create a new cURL resource
$ch = curl_init();

// Set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://www.tutorialpro.org/");
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);
?>

PHP cURL Reference Manual

❮ Func Date Date Parse Func Filesystem Fread ❯