我已經實施GCM發送消息在我的項目,它工作正常,直到7月28日,突然,應用程序開始發展問題。我從我的PHP應用程序服務器發送消息的代碼示例看起來像什麼網址可以用來實現新的GCM框架Http服務器
function setPush_Notification($device_Ids, $message) {
$url = "https://android.googleapis.com/gcm/send";
$GOOGLE_API_KEY = "MY_API_KEY";
$fields = array('registration_ids' => $device_Ids,
'data' => $message,
);
$headers = array(
'Authorization: key=' . $GOOGLE_API_KEY,
'Content-Type: application/json'
);
$ch = curl_init();
// Set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//Disabling SSL Certificate support temporarly
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
// Execute post
$result = curl_exec($ch);
if ($result === FALSE) {
print_r(curl_getinfo($ch));
die('Curl failed: ' . curl_error($ch));
}
curl_close($ch);
return $result;
}
但最近,我無法發送消息,它出現的問題是從網址爲每一次嘗試返回錯誤:
無法連接到2a00:1450:4016:804 :: 200a: 網絡無法訪問 而我從我的調查結果中發現服務器https://android.googleapis.com/gcm/send無法訪問,現在使用什麼網址將消息從第三方應用服務器發送到GCM? ?。
我試過別人的網址https://gcm-http.googleapis.com/gcm/send沒有成功。 有沒有其他人經歷過這個?請幫助
我的問題是沒有實現移動客戶端,其關於發送下游消息的第三方應用服務器..特別是如何實現從您的應用服務器發送消息到gcm服務器?你用什麼網址發佈數據到gcm?這是https://gcm-http.googleapis.com/gcm/send嗎?你可以請發一段代碼嗎? – simonbassey
@simonbassey對不起,編輯我的答案。 –
@simonbassey接受我的答案,如果這是有用的。 –