2014-03-19 91 views
0

我有以下代碼,將XML數據發送到Web服務, 我不斷收到此錯誤消息[GENERIC ERROR]作爲resopnse 我搜索得很好,找不到哪裏是錯誤,cURL張貼xml:獲取錯誤消息:通用錯誤

我不是來自啓用SSL的網站發送,我啓用了捲曲,

<?php 
include "curl.php"; 
$xml2 = "<CC5Request> 
<Name>esttest</Name> 
<Password>EST741852</Password> 
<ClientId>4444</ClientId> 
<Mode>P</Mode> 
<OrderId>8e8d031cb20a9d274f4ae3ccd0516053</OrderId> 
<Type>Auth</Type> 
<Number>4242424242424242</Number> 
<Expires>10/09</Expires> 
<Cvv2Val>000</Cvv2Val> 
<Total>4.72</Total> 
<UserId>ismail</UserId> 
<Currency>949</Currency> 
<email>[email protected]</email> 
<BillTo> 
<Name>ismail</Name> 
<Street1>deneme</Street1> 
<City>adfs</City> 
<PostalCode>06700</PostalCode> 
<Country>792</Country> 
<TelVoice>0_312_446_50_07</TelVoice> 
</BillTo> 
<ShipTo> 
<Name>ismail</Name> 
<Street1>deneme</Street1> 
<City></City> 
<PostalCode>06700</PostalCode> 
<Country>792</Country> 
</ShipTo> 
<Extra> 
</Extra> 
</CC5Request>"; 

$URL = "https://url/cc5ApiServer"; 

$ch = curl_init($URL); 
curl_setopt($ch, CURLOPT_MUTE, 1); 
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 
curl_setopt($ch, CURLOPT_POST, 1); 
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml')); 
curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml2"); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
$output = curl_exec($ch); 
if(curl_errno($ch)) 
    print curl_error($ch); 
else 
    print_r($output); 
curl_close($ch); 




?> 

回答

0

很可能是你得到的字符串實際上是響應主體從遠程服務器提供$ URL,因此curl沒有問題,問題在於服務器不喜歡您發送的確切內容。

+0

似乎服務器需要 DATA = <?xml version = \「1.0 \」encoding = \「ISO-8859-9 \」?> – mfadel

+0

......這使我的答案完全正確! –