Hi team,
I have a problem with api rest on my server for send my notification. The response is : {“result”:“error”,“message”:“Unable to Authenticate”}.
My code :
$msg = array
(
'alert' => 'Test Notif'
);
$fields = array
(
'tokens' => $tokens,
'notification' => $msg
);
$headers = array
(
'Authorization: Basic MySecretApiKey',
'Content-Type: application/json',
'X-Ionic-Application-Id: MyIdApp'
);
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, 'https://push.ionic.io/api/v1/push' );
curl_setopt($ch,CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch,CURLOPT_POSTFIELDS, json_encode($fields) );
$result = curl_exec($ch);
print_r($result);
curl_close($ch);
Where is the problem ?
Thx a lot