private function sendPushNotification($fields) {
        // Set POST variables
        $url = 'https://fcm.googleapis.com/fcm/send';
        $headers = array(
            'Authorization: key=' . $this->api_key,
            'Content-Type: application/json'
        );
        // Open connection
        $ch = curl_init();
        curl_setopt( $ch,CURLOPT_URL, $url );
        curl_setopt( $ch,CURLOPT_POST, true );
        curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
        curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
        curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );
        curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) );
		curl_setopt($ch, CURLINFO_HEADER_OUT, true);
        // Execute post
		$info = curl_getinfo($ch);

        $result = curl_exec($ch);
        if ($result === FALSE) {
            die('Curl failed: ' . curl_error($ch));
        }
        // Close connection
        curl_close($ch);
        return $result;
    }
private function sendPushNotification($fields) {
        // Set POST variables
        $url = 'https://fcm.googleapis.com/fcm/send';
        $headers = array(
            'Authorization: key=' . $this->api_key,
            'Content-Type: application/json'
        );
        // Open connection
        $ch = curl_init();
        curl_setopt( $ch,CURLOPT_URL, $url );
        curl_setopt( $ch,CURLOPT_POST, true );
        curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
        curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
        curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );
        curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) );
		curl_setopt($ch, CURLINFO_HEADER_OUT, true);
        // Execute post
		$info = curl_getinfo($ch);

        $result = curl_exec($ch);
        if ($result === FALSE) {
            die('Curl failed: ' . curl_error($ch));
        }
        // Close connection
        curl_close($ch);
        return $result;
    }
private function sendPushNotification ( $ fields ) { // Set POST variables $ url = 'https://fcm.googleapis.com/fcm/send' ; $ headers = array ( 'Authorization: key=' . $ this -> api_key , 'Content-Type: application/json' ) ; // Open connection $ ch = curl_init ( ) ; curl_setopt ( $ ch , CURLOPT_URL , $ url ) ; curl_setopt ( $ ch , CURLOPT_POST , true ) ; curl_setopt ( $ ch , CURLOPT_HTTPHEADER , $ headers ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , true ) ; curl_setopt ( $ ch , CURLOPT_SSL_VERIFYPEER , false ) ; curl_setopt ( $ ch , CURLOPT_POSTFIELDS , json_encode ( $ fields ) ) ; curl_setopt ( $ ch , CURLINFO_HEADER_OUT , true ) ; // Execute post $ info = curl_getinfo ( $ ch ) ; $ result = curl_exec ( $ ch ) ; if ( $ result === FALSE ) { die ( 'Curl failed: ' . curl_error ( $ ch ) ) ; } // Close connection curl_close ( $ ch ) ; return $ result ; }
function makes curl request to gcm servers
function makes curl request to gcm servers