我想用以下代码推送通知
我想得到的json是这样的
{
"data": {
"message": "Hello! Welcome to parse notifications.",
"title": "AndroidHive"
},
"is_background": false
}
下面是php代码
<?php
$url = 'https://api.parse.com/1/push';
$APPLICATION_ID = "T7G0qlJG5ygBVHZFVrqf8VO17vhQeeG3TnshxfQy";
$REST_API_KEY = "ywsoZIXPlrapASLHu5kvNBdCl7kfPe43OW3ugyZd";
$url = 'https://api.parse.com/1/push';
$data = array(
'channles'=>'',
'data'=>array('data'=>array(
'message'=>'Hello! Welcome to parse notifications.',
'title'=> 'ParseTest',
),
"is_background"=> false
),
);
$_data = json_encode($data);
$headers = array(
'X-Parse-Application-Id: ' . $APPLICATION_ID,
'X-Parse-REST-API-Key: ' . $REST_API_KEY,
'Content-Type: application/json',
);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $_data);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_exec($curl);
?>
但是没有任何东西发送到我的设备,任何人都知道如何解决它?谢谢。
答案 0 :(得分:0)
问题是卷曲,添加这样的代码使卷曲工作正常。
curl_setopt($curl,CURLOPT_SSL_VERIFYPEER ,false);
curl_setopt($curl,CURLOPT_SSL_VERIFYHOST ,false);