2009-07-16 55 views
1

我正在使用支付網關處理信用卡。要將數據發佈到他們的服務器,我在PHP中使用cURL。我有一個SSL證書頒發給我的域名,以確保所有POST的數據都被加密。由於SSL證書已經安裝,我仍然需要爲cURL使用SSL選項嗎?如果是這樣,那麼在給定我的設置的情況下,我需要設置哪些選項?支付網關使用cURL與SSL?

我曾嘗試下面的代碼失敗:

$ch = curl_init(); 

curl_setopt($ch, CURLOPT_URL,"https://secure.paymentgateway.com/blah.php"); 
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"); 

curl_setopt($ch, CURLOPT_VERBOSE, 1); 
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 
curl_setopt($ch, CURLOPT_CAINFO, getcwd().'/cert/ca.crt'); 
curl_setopt($ch, CURLOPT_SSLCERT, getcwd().'/cert/mycert.pem'); 
curl_setopt($ch, CURLOPT_SSLCERTPASSWD, 'password'); 

curl_setopt($ch, CURLOPT_POST, $count); 

curl_setopt($ch,CURLOPT_POSTFIELDS,"variables...");                 

$output = curl_exec($ch); 
echo $output; 
curl_close($ch); 
+0

我只是好奇,你可以指定它是支付網關? – 2009-07-16 18:46:42

回答