Hello there i'm writing a code for c2dm with php this is the code in drupal module, my problem is it is working on my localhost "wamp" server but when try using it on my centos 5 server, the var_dump($response) returns bool(false), my domain is certified and curl is working well on my server, is there any solution for my case?
function push_notifications_c2dm_token() {
$data = array(
'Email' => PUSH_NOTIFICATIONS_C2DM_USERNAME,
'Passwd' => PUSH_NOTIFICATIONS_C2DM_PASSWORD,
'accountType' => 'HOSTED_OR_GOOGLE',
'source' => 'Company-AppName-Version',
'service' => 'ac2dm',
);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, PUSH_NOTIFICATIONS_C2DM_CLIENT_LOGIN_ACTION_URL);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($curl);
var_dump($response); die();
curl_close($curl);
// Get the auth token.
preg_match("/Auth=([a-z0-9_\-]+)/i", $response, $matches);
$auth_token = $matches[1];
if (!$auth_token) {
watchdog('push_notifications', 'Google C2DM Server did not provide an authentication token.', NULL, WATCHDOG_ERROR);
}
else {
return $auth_token;
}
}