Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // API access key from Google API's Console
- define( 'API_ACCESS_KEY', 'AIzaSyB41Wf8s_i8kSU_0hX-UusCh3k8GiSpA6w' );
- $registrationIds = array( 'cyMSGTKBzwU:APA91bFcP4l_h7r9u1tlK58fx2bRff1Vo8xLgj0Vkhq9uHHPqgRgp3TW9DkIQcBn81Y0ToLK0Z95kgtkksKmeHrkA5YnrgEOtHq-U1ppt9BT-Kj01tLVA_J7S8_xMKgjgN32WfoJY6mI' ); //Device token for target device
- // Modify payload here
- $msg = array
- (
- //This is for redirect no 1
- // 'message' => 'You received a new message on wowintro!',
- // 'redirect' => '1',
- // 'user_key' => '1025',
- // 'user_name' => 'Amad Yus'
- //This is for redirect no 2
- // 'message' => 'Your wowintro was just favorited!',
- // 'redirect' => '2'
- //This is for redirect no 3
- // 'message' => 'You just got wowed!',
- // 'redirect' => '3'
- //This is for redirect no 4
- // 'message' => 'Your video has been uploaded!',
- // 'redirect' => '4'
- //This is for redirect no 5
- // 'message' => 'You have a knock on your door!',
- // 'redirect' => '5',
- // 'job_post_key' => '24'
- //This is for redirect no 6
- 'message' => 'A familiar face just registered with wowintro!',
- 'redirect' => '6',
- 'user_name' => 'ahmadyusri91'
- );
- $fields = array
- (
- 'registration_ids' => $registrationIds,
- 'data' => $msg
- );
- $headers = array
- (
- 'Authorization: key=' . API_ACCESS_KEY,
- 'Content-Type: application/json'
- );
- $ch = curl_init();
- curl_setopt( $ch,CURLOPT_URL, 'https://gcm-http.googleapis.com/gcm/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 );
- echo $result;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement