English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
(PHP 4 >= 4.0.2, PHP 5)
curl_init — Initialize a CURL session
resource curl_init ([ string $url = NULL ] )
Initialize a new session, return a CURL handle for use with curl_setopt(), curl_exec(), and curl_close() functions.
url
If this parameter is provided, the CURLOPT_URL option will be set to this value. You can also use the curl_setopt() function to manually set this value.
If successful, returns a CURL handle, returns FALSE if an error occurs.
Initialize a new CURL session and fetch a web page
<?php // Create a new CURL resource $ch = curl_init(); // Set the URL and corresponding options curl_setopt($ch, CURLOPT_URL, "http://www.oldtoolbag.com/"); curl_setopt($ch, CURLOPT_HEADER, 0); // Fetch the URL and pass it to the browser curl_exec($ch); // Close the CURL resource and release the system resources curl_close($ch); ?>