This is an example for building headers for a cURL call in PHP:
$ch = curl_init();
$user_agent = 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)';
…
$headers = array();
$headers[] = "POST " . $postPath . " HTTP/1.1";
$headers[] = "Host: " . $postHost;
$headers[] = "Content-type: text/xml";
$headers[] = "Content-length: " . mb_strlen($content, "UTF-8");
$headers[] = "Connection: close";
…
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
The complete code sample is here:
http://www.tanguay.info/web/codeExample.php?id=993