ColdFusion CFHTTP中的PHP CURL SSL证书

时间:2015-02-11 10:05:36

标签: php ssl curl coldfusion cfhttp

我正在使用ColdFusion,但我们的示例代码是用PHP编写的。

我们需要与第三方系统集成,这要求我们包含SSL证书以及SSL密钥。

我试图四处寻找,但找不到任何解决方案。有没有人遇到过这个问题?

以下是我们从合作伙伴处收到但用PHP编写的示例代码。感谢是否有人有解决方案将其转换为ColdFusion CFHTTP

$header   = array();
$header[] = "Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"; 
$header[] = "Cache-Control: max-age=0"; 
$header[] = "Connection: keep-alive"; 
$header[] = "Keep-Alive:timeout=5, max=100"; 
$header[] = "Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3"; 
$header[] = "Accept-Language:es-ES,es;q=0.8"; 
$header[] = "Pragma: "; 
$header[] = "X_ENTITY_KEY: " . $entity_key; 

$tuCurl = curl_init();
   curl_setopt($tuCurl, CURLOPT_URL, $url);
   curl_setopt($tuCurl, CURLOPT_PORT , 443);
   curl_setopt($tuCurl, CURLOPT_VERBOSE, 0);
   curl_setopt($tuCurl, CURLOPT_HTTPHEADER, $header);
   curl_setopt($tuCurl, CURLOPT_SSL_VERIFYPEER, 0);
   curl_setopt($tuCurl, CURLOPT_SSL_VERIFYHOST, 0);
   curl_setopt($tuCurl, CURLOPT_SSLCERT, $path . '/api/file.pem');
   curl_setopt($tuCurl, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt($tuCurl, CURLOPT_SSLKEY, $path . '/api/file.key');

echo $exec = curl_exec($tuCurl);

curl_close($tuCurl);
$data = json_decode($exec, TRUE);

0 个答案:

没有答案