Friday, 30 November 2012

PHP CURL functions

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);
?>

No comments:

Post a Comment

Thank you so much for providing your valuable feedback. I will will look into them and update my skills & technologies accordingly.