0
PHP 런타임을 사용하여 appengine에서 gcm을 사용하려고합니다. 다음 URL 가져 오기 서비스PHP GCM appengine
$context = array("https"=>
array("method" => "post",
"content" => json_encode($fields),
"header" => "Content-Type: application/json\r\n" .
"Authorization: key=" . GOOGLE_API_KEY . "\r\n"
)
);
$context = stream_context_create($context);
$result = file_get_contents($url, false, $context);
를 사용하는 코드는 PHP 컬을 사용하는 기존 코드는 다음과 같은 :
$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);
에서 appengine의 URL을 가져올 서비스를 사용
PHP 컬이 잘 작동 사용하는 코드,하지만 코드 일하지 않아. 누군가 내가 잘못하고 있다고 나에게 말할 수 있습니까?
어떤 오류가 나타 납니까? –
오류가 표시되지 않습니다. 하지만 'https://android.googleapis.com/gcm/send'가 'http://developer.android.com/google/gcm/index.html'으로 리디렉션되고 있으며 GCM 메시지가 전송되지 않습니다. –
주세요 내 솔루션에 봐. 그것은 일하고 : http://stackoverflow.com/questions/17998875/googlecloudmessaging-returning-invalidregistration –