0

im want to use curl with php to send push-messages to an ionic-app. this is my command im using on the commandline:

curl -X POST -H "Authorization: Bearer XXXXXX.AUTH.XXXXXXX" -H "Content-Type: application/json" -d '{
    "tokens": ["XXXX.DEVICE_TOKEN.XXXX"],
    "profile": "XXXX.PROFILE.XXXXX",
    "notification": {
        "message": "This is a test-message",
        "title": "This is a Test Title"
    }
}' "https://api.ionic.io/push/notifications"

how can i execute this command in php? i found some examples, but none of them works.

Boeringer
  • 195
  • 1
  • 1
  • 11
  • Show us what you tried and what happened (error messages?) and we might be able to point you in the right direction. – M. Eriksson Nov 05 '16 at 01:10
  • Look at this examples http://stackoverflow.com/questions/30426047/correct-way-to-set-bearer-token-with-curl maybe Bearer token isn't correct? What error/response do you receive from the API ? – Mateusz Palichleb Nov 05 '16 at 01:14
  • the command works fine on my machine (osx) and on a debian machine, so the bearer token is correct. my problem is to figure out, how to execute this command with php. – Boeringer Nov 05 '16 at 01:26
  • ...you still need to show us what you tried in PHP (since you said that you tried some examples) and what it was that didn't work. Did you get any error messages? Invalid response? – M. Eriksson Nov 05 '16 at 01:29

0 Answers0