?? There are lots of examples on the curl manual page. Mostly in the user comments. Just ignore the huge list of constants until you actually need them. (And even then look for the link in the comments which actually explains what those options mean.)
Anyway, here's what I use to post data to a site using a certificate. (Certificates are not normally needed. This particular site I'm calling requires it for security purposes.)
$tmparray = array();
foreach ($postfields as $key => $value) {
$tmparray[] = urlencode($key).'='.urlencode($value);
}
$postdata = implode('&', $tmparray);
$ch = curl_init(); // First initialize curl
// Set the options we want
curl_setopt($ch, CURLOPT_URL, $url); // Set the url
curl_setopt($ch, CURLOPT_HEADER, 0); // Don't save the reponse headers
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Do save the body of the response
curl_setopt($ch, CURLOPT_POST, 1); // Doing a post
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata); // The data to post
curl_setopt($ch, CURLOPT_SSLCERT, '/path/to/cert.pem'); // The certificate to use
$response = curl_exec($ch); // Actually do the post and give me back the response
if (curl_error($ch)) { // Log any errors
trigger_error('Error executing curl: '.curl_errno($ch).' - '.curl_error($ch), E_USER_WARNING);
}
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE); // Get the response code