Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $msg = array
- (
- 'body' => 'Test Test',
- 'title' => 'Test',
- 'click_action' => 'https://google.com/',
- 'icon' => 'smallicon',/*Default Icon*/
- 'sound' => 'mySound'/*Default sound*/
- );
- $fields = array
- (
- 'to' => 'token',
- 'notification' => $msg
- );
- $headers = array
- (
- 'Authorization: key=',
- 'Content-Type: application/json'
- );
- $ch = curl_init();
- curl_setopt( $ch,CURLOPT_URL, 'https://fcm.googleapis.com/fcm/send' );
- curl_setopt( $ch,CURLOPT_POST, true );
- curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
- curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
- curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );
- curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) );
- $result = curl_exec($ch );
- curl_close( $ch );
Add Comment
Please, Sign In to add comment