skip to Main Content

I used Web Push PHP library
https://github.com/Minishlink/web-push-php-example to send push notifications, but I found a problem:

Referrer Policy: strict-origin-when-cross-origin

For your information, I used

  1. PHP –Version
PHP 7.2.34 (cgi-fcgi) (built: Nov  4 2020 16:02:13)
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
  1. Link to this sample: https://i-confident.com/admin/web-push-php-example/src/index.html

Anyone can help me? Thanks in advance!

enter image description here

2

Answers


  1. use

    header('Access-Control-Allow-Origin: *'); or both
    header('Content-type: application/json'); (if want to access your json post data )
    
    **in your send_push_notification.php file at the top**
    and also use "www." for your url "https://i-confident.com/.." cause i recently face issue in which i didnt add www. in my url and was not receiving post/get data in my targeted file.
    
    Login or Signup to reply.
  2. First you need install php extension in my case:

    sudo apt install php7.4-gmp
    

    Also you need the checkout the branch:

    git checkout v2.x
    

    Then you should update your dependencies via composer:

    composer update
    

    And then it’s should work I checked.

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search