php와 연동으로 gcm을 구현하고 있는데
$registration_id = "디바이스 regstration_id";
$auth = "apikey";
$message = "TEST MESSAGE";
$headers = array
(
'Content-Type:application/json',
'Authorization:key='.$auth
);
$arr = array();
$arr['data'] = array();
$arr['data']['msg'] = "TEST MESSAGE";
$arr['registration_ids'] = array();
$arr['registration_ids'][0] = $registration_id;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://android.googleapis.com/gcm/send');
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($arr));
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
$response = curl_exec($ch);
if($response === FALSE)
{
die('Curl failed: ' .curl_error($ch));
}
curl_close($ch);
echo $response;
이렇게 두고 url로 접근해서 push 메세지가 오는자 확인해보려던 중인데 브라우저에 Curl failed: couldn't connect to host 만 찍히네요 이런 접근 방식이 잘못된건가요 아니면 뭔가 코드상에 문제가 있는건가요?
php는 전혀 몰라서 골치아프네요