Last active
April 25, 2020 14:06
-
-
Save phamquocbuu/a182a6ea1fce190b3cf91639d61c8fb3 to your computer and use it in GitHub Desktop.
Subscribe một token tới một topic, có hỗ trợ sub theo mảng token - xem thêm https://developers.google.com/instance-id/reference/server#create_a_relation_mapping_for_an_app_instance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$curl = curl_init(); | |
curl_setopt_array($curl, array( | |
CURLOPT_URL => "https://iid.googleapis.com/iid/v1/DEVICE_TOKEN/rel/topics/TOPIC_NAME", | |
CURLOPT_RETURNTRANSFER => true, | |
CURLOPT_ENCODING => "", | |
CURLOPT_MAXREDIRS => 10, | |
CURLOPT_TIMEOUT => 0, | |
CURLOPT_FOLLOWLOCATION => true, | |
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, | |
CURLOPT_CUSTOMREQUEST => "POST", | |
CURLOPT_HTTPHEADER => array( | |
"Authorization: key=SERVER_KEY", | |
"Content-Type: application/json" | |
), | |
)); | |
$response = curl_exec($curl); | |
curl_close($curl); | |
echo $response; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment