Send Mass Push Notifications By Platform - PHP

Source Code:

  
                 $api_endpoint = "http://send.pushnotificationapi.com/v1/";
$api_method = "push/send_by_platform";

$post_fields = array(
    "api_key" => "YOUR_API_KEY",    // Your App API Key
    "msg_title" => "My Push Notification",    // Message Title
    "platform" => "Android",    // Specify platform to send push to.
    "destination_url" => ""  // URL you want to open when user tap on notification.
);

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $api_endpoint . $api_method);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_fields));

// receive server response ...
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$server_output = curl_exec ($ch);

curl_close ($ch);

// API response ....
echo $server_output;