【发布时间】:2020-10-15 10:41:35
【问题描述】:
我正在使用 Minishlink/WebPush 包将推送通知从我的服务器发送到我的客户端,但我收到此错误:
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)"
}
这是我的代码:
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
);
我的客户端上的 sw 代码正在工作,因为我尝试使用 javascript 手动将通知推送到我注册的 sw。
【问题讨论】:
标签: javascript php progressive-web-apps web-push