PHP curl_exec Function
Home | HTML | JavaScript | CSS | PHP | Python3 | Java | C | C++ | C# | Go | SQL | Linux | Git
PHP cURL Reference
PHP curl_exec Function
(PHP 4 >= 4.0.2, PHP 5)
curl_exec β Execute a cURL session
Description
mixed curl_exec ( resource $ch )
Executes the given cURL session.
This function should be called after initializing a cURL session and all the options for the session have been set.
Parameters
ch
A cURL handle returned by curl_init().
Return Values
Returns TRUE on success or FALSE on failure. However, if the CURLOPT_RETURNTRANSFER option is set, it will return the result of the execution on success and FALSE on failure.
Example
Fetching a web page
<?php
// Create a cURL resource
$ch = curl_init();
// Set URL and corresponding options
curl_setopt($ch, CURLOPT_URL, "http://www.w3cschool.cc/");
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);
?>
YouTip