Gooday Note Scrap Source Android login
 
작성일 : 12-10-10 17:55
GCM
 글쓴이 : 기리
조회 : 4,077   추천 : 0   비추천 : 0  

Google Cloud Messaging using PHP

http://labs.distriqt.com/post/1273

Android GCM with php
http://blog.daum.net/haha25/5388237

My PHP script for GCM Device Registration
http://skipstechtalk.net/2012/07/31/my-php-script-for-gcm-device-registration/

Zend 이용법
http://stackoverflow.com/questions/11242743/gcm-with-php-google-cloud-messaging

$url = 'https://android.googleapis.com/gcm/send';
$serverApiKey
= "YOUR API KEY AS GENERATED IN API CONSOLE";
$reg
= "DEVICE REGISTRATION ID";

$data
= array(
       
'registration_ids' => array($reg),
       
'data' => array('yourname' => 'Joe Bloggs')
);




print(json_encode($data));

$client
= new Zend_Http_Client($url);
$client
->setMethod('POST');
$client
->setHeaders(array("Content-Type" => "application/json", "Authorization" => "key=" . $serverApiKey));
$client
->setRawData(json_encode($data));
$request
= $client->request('POST');
$body
= $request->getBody();
$headers
= $request->getHeaders();
print("<xmp>");
var_dump
($body);
var_dump
($headers);

기리 12-10-10 18:10