CURL代碼:
$curl = curl_init();
curl_setopt($curl,CURLOPT_URL,$url);
curl_setopt($curl, CURLOPT_PORT, 443);
curl_setopt($curl, CURLOPT_SSLVERSION, 3);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); //信任任何認證
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // 檢查認證中是否設定網域名稱,0不驗證
curl_setopt($curl, CURLOPT_VERBOSE, 1); //debug模式
curl_setopt($curl, CURLOPT_SSLCERT, "./keys/client.crt"); //client.crt檔案路徑
curl_setopt($curl, CURLOPT_SSLCERTPASSWD, "112358"); //client認證密碼
curl_setopt($curl, CURLOPT_SSLKEY, "./keys/client.key");
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
一直返回 int 58 這個CURL錯誤
int 58
unable to use client certificate (no key found or wrong pass phrase?)
把認證重建了一次,還是不行
本地環境 WAMP 產生的認證直接在IE瀏覽器上安全是可以訪問的
有沒有同學遇到過呢?
回複討論(解決方案)
自己解決了,之前是認證產生的不對,現在是路徑寫的不對……
這段代碼先保留了。以後參考。
想問下,client.crt和client.key是怎麼獲得的呢,對方只給了我p12檔案和一個crt檔案