私の国の支払いプラットフォームのmailwizzで支払いゲートウェイを開発しようとしていました。その後、支払いゲートウェイのクラスを使用してトランザクションを確認するために、私はエラーを得た... HERESに私はこの問題は、支払いゲートウェイのクラス内から来ていると思うどこカールが暗号化された接続を確立しようとしますが、ない場合に発生curlがレスポンスで失敗しました:mailwizzで「ローカル発行者証明書を取得できません」
private function callViaCurl($interface, $payload = [ ], $sentargs = [ ])
{
$endpoint = PaystackHelpersRouter::PAYSTACK_API_ROOT . $interface[PaystackContractsRouteInterface::ENDPOINT_KEY];
$method = $interface[PaystackContractsRouteInterface::METHOD_KEY];
$this->moveArgsToSentargs($interface, $payload, $sentargs);
$this->putArgsIntoEndpoint($endpoint, $sentargs);
$headers = ["Authorization"=>"Bearer " . $this->secret_key ];
$body = '';
if (($method === PaystackContractsRouteInterface::POST_METHOD)
|| ($method === PaystackContractsRouteInterface::PUT_METHOD)
) {
$headers["Content-Type"] = "application/json";
$body = json_encode($payload);
} elseif ($method === PaystackContractsRouteInterface::GET_METHOD) {
$endpoint = $endpoint . '?' . http_build_query($payload);
}
//open connection
$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, $endpoint);
if ($method === PaystackContractsRouteInterface::POST_METHOD || $method === PaystackContractsRouteInterface::PUT_METHOD) {
($method === PaystackContractsRouteInterface:: POST_METHOD) && curl_setopt($ch, CURLOPT_POST, true);
($method === PaystackContractsRouteInterface ::PUT_METHOD) && curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
}
//flatten the headers
$flattened_headers = [];
while (list($key, $value) = each($headers)) {
$flattened_headers[] = $key . ": " . $value;
}
curl_setopt($ch, CURLOPT_HTTPHEADER, $flattened_headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Make sure CURL_SSLVERSION_TLSv1_2 is defined as 6
// Curl must be able to use TLSv1.2 to connect
// to Paystack servers
if (!defined('CURL_SSLVERSION_TLSV1_2')) {
define('CURL_SSLVERSION_TLSV1_2', 6);
}
curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSV1_2);
$response = curl_exec($ch);
if (curl_errno($ch)) { // should be 0
// curl ended with an error
$cerr = curl_error($ch);
curl_close($ch);
throw new Exception("Curl failed with response: '" . $cerr . "'.");
}
// Then, after your curl_exec call:
$resp = json_decode($response);
//close connection
curl_close($ch);
if (!$resp->status) {
throw new Exception("Paystack Request failed with response: '" . $resp->message . "'.");
}
return $resp;
}
他の読者には、明確な問題文がない質問は役に立ちません。参照:最小、完全、および検証可能なサンプル(http://stackoverflow.com/help/mcve)の作成方法 –
[curl:(60)SSL証明書:ローカル発行者証明書を取得できません](http: /stackoverflow.com/questions/24611640/curl-60-ssl-certificate-unable-to-get-local-issuer-certificate) – Clay