Error with php-curl in ubuntu Server

0

I have an error using php - curl.

This PHP file helps me send notifications from my server to firebase.

I've tried it on a local server with windows and that same file works perfectly, but when I try it on my linux server it does not work. In that case, when placing the url in the browser it does not load me, it remains blank and I do not execute anything.

    <?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', '');

$registrationIds = [""];


// prep the bundle
$msg = [
    'title' => 'titulo',
    'body' => 'Prueba '
];

$fields = [
    'registration_ids' => $registrationIds,
    'notification' => $msg
];

$headers = [
    'Authorization: key=' . API_ACCESS_KEY,
    'Content-Type: application/json'
];
$fields = json_encode( $fields );

$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_SSL_VERIFYPEER, false );
curl_setopt( $ch,CURLOPT_POSTFIELDS, $fields );
$result = curl_exec($ch );
curl_close( $ch );

echo $result;

?>
    
asked by Cediendo_Lo_Aprendido 06.07.2017 в 15:52
source

0 answers