Showing posts with label PHP curl. Show all posts
Showing posts with label PHP curl. Show all posts

Monday, October 3, 2011

List out curl functions in PHP

The following function are used to call CURL in php,
curl_init() - Initialize a cURL session
curl_setopt() - Set an option for a cURL transfer
curl_exec() - Perform a cURL session
curl_close() - Close a cURL session
curl_errno() - Return the last error number
curl_error() - Return a string containing the last error for the current session
curl_version() - Gets cURL version information
curl_getinfo() - Get information regarding a specific transfer

Example:

$ch = curl_init("http://www.example.com/");
$fp = fopen("example_homepage.txt", "w");

curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);

curl_exec($ch);
curl_close($ch);
fclose($fp);
?>