Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function curl()
- {
- $api_key = "AIzaSyAS6TCYSTEJhLZ0gkFEvK9fbVylVxvlJqs";
- $registrationIDs = "AAAAbRNUN9o:APA91bF7GjvxW2PuOoxG_PKGho7lJ2gkfISdGm4m5sJwKuM1tCTqH0PrcgNPGB1SgpjIlM7_mgNy-hNJtSbYBop9ShNdRqZHqpIEAA4noLS6enz_5zBpXeaV6peRXSzb5iUjON4ypIlD";
- $data = array(
- "to" => array($registrationIDs),
- "notification" => array("title" => "Shareurcodes.com", "body" => "A Code Sharing Blog!", "icon" => "icon.png", "click_action" => "http://shareurcodes.com")
- );
- $data_string = json_encode($data);
- echo "The Json Data : " . $data_string;
- $headers = array(
- 'Authorization: key=' . $api_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_POSTFIELDS, $data_string);
- $result = curl_exec($ch);
- curl_close($ch);
- dd($result);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement