我試圖使用我自己的API使用下面的代碼發送推送通知。我確定我的服務器啓用了curl。作爲迴應,我得到了下面的結論。curl對api的post請求無法使用php
$url = "http://efpushtest.meteor.com/api/push";
# Our new data
$data = json_encode(array(
'message' => "this is venkat test push message",
'device' => "12345"
));
$ch = curl_init($url);
# Setting our options
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
# Get the response
$result = curl_exec($ch);
curl_close($ch);
響應:
{ 「成功」:假的, 「消息」: 「意外令牌U」}
,我沒有得到我在哪裏,此代碼腳麻。
服務正在等待用於'POST'參數或'JSON'? – Kypros 2014-10-18 14:29:24
等待帖子參數 – 2014-10-18 14:30:46