0

I'm using Minishlink/WebPush package to send a push notification from my server to my client but I'm getting this error:

array(3) {
  ["success"]=>
  bool(false)
  ["endpoint"]=>
  string(188) "***"
  ["message"]=>
  string(179) "cURL error 77: error setting certificate verify locations:
  CAfile: C:\xampp\apache\bin\curl-ca-bundle.crt
  CApath: none (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)"
}

This is my code:

require __DIR__ . '../../../vendor/autoload.php';
use Minishlink\WebPush\WebPush;

$vapidAuth = array(
                'VAPID' => array(
                    'subject' => 'https://github.com/Minishlink/web-push-php-example/',
                    'publicKey' => '***',
                    'privateKey' => '***'
                )
            );
$webPush = new WebPush($vapidAuth);
$res = $webPush->sendNotification(
     $subscription['ius_endpoint'],
     'hello world!',
     $subscription['ius_p256dh'],
     $subscription['ius_auth'],
     true
);

My sw code on my client is working because I've tried to manually push a notification using javascript to my registered sw.

boosted_duck
  • 478
  • 3
  • 15

1 Answers1

-1

I found out an answer here

  1. Download the certificate from: https://curl.haxx.se/ca/cacert.pem
  2. Rename the cacert.pem file into curl-ca-bundle.crt
  3. Copy the file into path/to/xampp/apache/bin
  4. Restart apache
boosted_duck
  • 478
  • 3
  • 15