Google gcm and curl question
I have 2 vps that apparently they they have the same configuration:
centos 6.5
cpanel 11.44
suphp
csf/lfd (identical configuration)
mod_security
etc.etc....
the problem is that a script for push messages return 401 error on first vps and 200 in second vps
both ip added in whitelist of gcm service
first vps return:
[PHP]HTTP/1.1 401 Unauthorized
Content-Type: text/html; charset=UTF-8
Date: Sat, 19 Jul 2014 11:51:41 GMT
Expires: Sat, 19 Jul 2014 11:51:41 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Alternate-Protocol: 443:quic
Transfer-Encoding: chunked[/PHP]
second vps return:
[PHP]HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Date: Sat, 19 Jul 2014 11:43:44 GMT
Expires: Sat, 19 Jul 2014 11:43:44 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Alternate-Protocol: 443:quic
Transfer-Encoding: chunked[/PHP]
the script is:
[PHP] array( $reg_id ),
'data' => array( "shipment" => $message, "numtrack" => $spedizione ),
);
$headers = array(
'Authorization: key=' . GOOGLE_API_KEY,
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, GOOGLE_GCM_URL);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
$result = curl_exec($ch);
if ($result === FALSE) {
die('Problem occurred: ' . curl_error($ch));
}
curl_close($ch);
echo "$result
"; } send_gcm_notify("xxxxxxxxxxxxxxxxxxxxxxxx", "ok", "1");[/PHP]
"; } send_gcm_notify("xxxxxxxxxxxxxxxxxxxxxxxx", "ok", "1");[/PHP]
-
Hello :) Have you checked with Google's support to see if they are able to troubleshoot the issue further based on the output you provided? Thank you. 0
Please sign in to leave a comment.
Comments
1 comment