1 post / 0 new
chebonv
cURL error 60: SSL certificate problem: unable to get local issuer certificate
Fatal error: Uncaught GuzzleHttp\Exception\RequestException: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) in C:\xampp\htdocs\mpesa\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php:187 Stack trace: #0 C:\xampp\htdocs\mpesa\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(150): GuzzleHttp\Handler\CurlFactory::createRejection(Object(GuzzleHttp\Handler\EasyHandle), Array) #1 C:\xampp\htdocs\mpesa\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(103): GuzzleHttp\Handler\CurlFactory::finishError(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory)) #2 C:\xampp\htdocs\mpesa\vendor\guzzlehttp\guzzle\src\Handler\CurlHandler.php(43): GuzzleHttp\Handler\CurlFactory::finish(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory)) #3 C:\xampp\htdocs\mpesa\vendor\guzzlehttp\guzzle\src\Handler\Proxy.php(28): Guz in C:\xampp\htdocs\mpesa\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 187 My Code Below  <?php require 'vendor/autoload.php'; $client = new GuzzleHttp\Client(); $credentials = base64_encode('CustomerKey:CustomerSecret'); // Create a POST request $response = $client->request( 'GET', 'https://sandbox.safaricom.co.ke/oauth/v1/generate?grant_type=client_credentials', [ 'Authorization' => ['Basic '.$credentials ] ] ); // Parse the response object, e.g. read the headers, body, etc. $headers = $response->getHeaders(); $body = $response->getBody(); // Output headers and body for debugging purposes var_dump($headers, $body); $publicKey = "https://developer.safaricom.co.ke/sites/default/files/cert/cert.cer"; //$plaintext = "Safaricom132!"; $plaintext = "chebon"; openssl_public_encrypt($plaintext, $encrypted, $publicKey, OPENSSL_PKCS1_PADDING); echo base64_encode($encrypted);