This can be requested in the Google account, tick the GCM service option $apikey = ' aizasyc6h3ysrn2hdcbqonto2vkivvuktifoxxx '; $headers = Array ("Content-type :" . " Application/json "," Authorization: "." Key= ". $apiKey); $messageData = Array (' type ' = = 1, ' msg ' = ' news test ', ' push_id ' = +);//Device Tok En,android the client obtains, registers the time to save in the database//connection can push to many clients, here is recommended maximum 1000 $regid = Array (' apa91beapimawo4kg5tlul__ Skvtwits6j7vdvpjew1bv1ddchszytucz0pcgdtdaasl1bqdvtgmvcin4i8u9hz8fnuqpm3jwwy4dwvxhpzmer4no18orjliox97buun_ FGZZYBWWOSXJY_H5PJHSI0WOWZCYDGSLQ ', ' apa91bhy-f_u-ovemrm_ Hrjegcd7qdxxffh4unjiabiibtd1mvuc2bsqsdhvtpnhrmhn-e3msnganwayn7s62uzqtrzyngjl29lbtkhwwuzaywwk1v99lyk4icn_ Tqfwciftunwqlgjnoprszyf5yllktzkpoug3oq ', ' Apa91bhhegucpz7wh6kc9dphiv67asfq1wog7fk5n18msow5ehateqafhyvhpxgc3ankkggfn0abqi3r3kf6ykalgjqrpjxj_ Halhccuprikxyjikpiumyp1pb6xznawetzhydswprkgoesngcx19rvgwhs2jjoqwq ', ' Apa91be6hyqv19qok6sgfqnmeia2d47-i82dxtprrgce9mxjifi-nyglgs_6hoamb7tqrssq9m0dhkhdudyygdze3tbt_ Zymrxdcfa6by1lctzpnudncdvp3h-yqt3j1yzimwvsoftqnlj9ggrjm54rnao5p2q6e2g ', ' Apa91bengetky8rz9r3cct82et62kvkezzdmtww1pukmf3vok3bh_ O4qak9psruztzwd15chkeabimi_9mp3j0bnrjox1nqo25oooz5kkolppukpvm7byftggqrsitkbs_tpp2wg8a3bonewr9cbjmofywzjimbfxa ' , ' apa91bfebqggqemabmab62xocpf1rejgjmqbekjtfvek7hurl5a7zveq-0-7v6ekq6ryehgr8azza5cee1izsjt47hvfgmafqid7yeiaso7wyw9en0x M4GLNJGGGSFY6VNBQOGSP6FTIXVFUKEHZZCJB8U1IBCZZGW ',); $data = Array (' data ' = $messageData, ' registration_ids ' => ; $regid); $url = "Https://android.googleapis.com/gcm/send"; $ch = Curl_init (); curl_setopt ($ch, Curlopt_httpheader, $headers); curl_setopt ($ch, Curlopt_url, $url); curl_setopt ($ch, curlopt_ssl_verifyhost, 0); curl_setopt ($ch, Curlopt_ssl_ Verifypeer, 0); curl_setopt ($ch, Curlopt_returntransfer, True); curl_setopt ($ch, Curlopt_postfields, Json_encode ($ Data), $response = Curl_exec ($ch), Curl_close ($ch), Var_dump ($response);
Send push notifications to Android clients with Google GCM