Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php function sendPushNotification($to, $title, $body, $data = []) { // Endpoint FC..

Decoded Output download

<?php 
function sendPushNotification($to, $title, $body, $data = []) { 
    // Endpoint FCM 
    $url = 'https://fcm.googleapis.com/fcm/send'; 
     
    // Chave do servidor FCM 
    $serverKey = 'SUA_CHAVE_DO_SERVIDOR_AQUI'; 
 
    // Cabealhos da requisio 
    $headers = [ 
        'Authorization: key=' . $serverKey, 
        'Content-Type: application/json', 
    ]; 
 
    // Dados da notificao 
    $fields = [ 
        'to' => $to, // Token do dispositivo 
        'notification' => [ 
            'title' => $title, 
            'body' => $body, 
            'sound' => 'default' 
        ], 
        'data' => $data, // Dados adicionais 
    ]; 
 
    // Inicializa o cURL 
    $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)); 
 
    // Executa a requisio 
    $result = curl_exec($ch); 
    if ($result === FALSE) { 
        die('Erro ao enviar notificao: ' . curl_error($ch)); 
    } 
 
    curl_close($ch); 
 
    return $result; 
} 
 
// Uso do exemplo 
$deviceToken = 'TOKEN_DO_DISPOSITIVO_AQUI'; 
$title = 'Ttulo da Notificao'; 
$body = 'Mensagem do corpo da notificao'; 
$data = ['chave1' => 'valor1', 'chave2' => 'valor2']; 
 
$response = sendPushNotification($deviceToken, $title, $body, $data); 
echo 'Resposta: ' . $response; 
?> 

Did this file decode correctly?

Original Code

<?php
function sendPushNotification($to, $title, $body, $data = []) {
    // Endpoint FCM
    $url = 'https://fcm.googleapis.com/fcm/send';
    
    // Chave do servidor FCM
    $serverKey = 'SUA_CHAVE_DO_SERVIDOR_AQUI';

    // Cabealhos da requisio
    $headers = [
        'Authorization: key=' . $serverKey,
        'Content-Type: application/json',
    ];

    // Dados da notificao
    $fields = [
        'to' => $to, // Token do dispositivo
        'notification' => [
            'title' => $title,
            'body' => $body,
            'sound' => 'default'
        ],
        'data' => $data, // Dados adicionais
    ];

    // Inicializa o cURL
    $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));

    // Executa a requisio
    $result = curl_exec($ch);
    if ($result === FALSE) {
        die('Erro ao enviar notificao: ' . curl_error($ch));
    }

    curl_close($ch);

    return $result;
}

// Uso do exemplo
$deviceToken = 'TOKEN_DO_DISPOSITIVO_AQUI';
$title = 'Ttulo da Notificao';
$body = 'Mensagem do corpo da notificao';
$data = ['chave1' => 'valor1', 'chave2' => 'valor2'];

$response = sendPushNotification($deviceToken, $title, $body, $data);
echo 'Resposta: ' . $response;
?>

Function Calls

None

Variables

None

Stats

MD5 61f2c222d3843aba474253196d10f37c
Eval Count 0
Decode Time 41 ms