Merhaba ben şu anda harici bir sunucuya bir xml dosyayı göndermek için çalışıyorum, ama ben başlıkları yanlış bir yanıtı geri alıyorum. Ben ilanı olduğum sunucu bazı başlıkları gerektirir ve doğru biçimde ya da dahil edilmesi gereken başka bir "standart" başlıkları varsa eğer ben merak ediyorum?
Benim kod:
<?php
function httpsPost($Url, $xml_data, $headers)
{
   // Initialisation
   $ch=curl_init();
   // Set parameters
   curl_setopt($ch, CURLOPT_FORBID_REUSE, 1); 
   curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
   curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);    
   curl_setopt($ch, CURLOPT_URL, $Url);
   // Return a variable instead of posting it directly
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt($ch,CURLOPT_USERPWD,"username:password");
   // Active the POST method
   curl_setopt($ch, CURLOPT_POST, 1) ;
   // Request
   curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_data);
   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
   curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
   // execute the connexion
   $result = curl_exec($ch);
   // Close it
   curl_close($ch);
   return $result;
}
$headers[0]="BATCH_TYPE: XML_SINGLE"; 
$headers[1]="BATCH_COUNT: 1"; 
$headers[2]="VENDOR_ID: 53906";
$request_file = "./post_this.xml"; 
$fh = fopen($request_file, 'r'); 
$xml_data = fread($fh, filesize($request_file)); 
fclose($fh); 	
$url = 'http://www.example.com/test.php';
$Response = httpsPost($url, $xml_data, $headers);
echo $Response;
?>
 
			