How to Send Push Notification Via CURL PHP PushWoosh

Send Push Notification via PHP cURL API. A simple API call to create message pushwoosh.

This is a code snippet to send a message via PHP cURL through the PushWoosh API. 

define('PW_AUTH', 'TOKEN');
define('PW_DEBUG', false);

function pwCall($method, $data) {
    $url = '' . $method;
    $request = json_encode(['request' => $data]);
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
    curl_setopt($ch, CURLOPT_HEADER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
    $response = curl_exec($ch);
    $info = curl_getinfo($ch);
    if (defined('PW_DEBUG') && PW_DEBUG) {
        print "[PW] request: $request\n";
        print "[PW] response: $response\n";
        print '[PW] info: ' . print_r($info, true);

pwCall('createMessage', array(
    'application' => PW_APPLICATION,
    'auth' => PW_AUTH,
    'notifications' => array(
                'send_date' => 'now',
                'content' => "My Content Push Notification",
                'devices' => array("device_token", "device_token"),