php - Why android GCM server gives a timeout after some subsequent GCM request -
my server sents gcm request gcm api push notification.the push notification works fine couple of push notification, after curl function making request getting timed out following error
"curl failed: failed connect android.googleapis.com port 443: connection timed out"
without response.but response code 200ok.
but again after sometime if try sent notification proper success response , if try sending sometime, different devices again hangs , shows above message.
i have opened port 5228, 5229, , 5230 on firewall.
why happen.i can't figure why happening this.
this code im using
$headers = array( 'authorization: key=' . $this->serverapikey, 'content-type: application/json' ); // open connection $ch = curl_init(); // set url, number of post vars, post data curl_setopt( $ch, curlopt_url, $this->url ); curl_setopt($ch, curlopt_port, 443); curl_setopt( $ch, curlopt_post, true ); curl_setopt( $ch, curlopt_httpheader, $headers); curl_setopt( $ch, curlopt_returntransfer, true ); curl_setopt( $ch, curlopt_postfields, json_encode( $fields ) ); // avoids problem https certificate curl_setopt( $ch, curlopt_ssl_verifyhost, false); curl_setopt( $ch, curlopt_ssl_verifypeer, false); // execute post $result = curl_exec($ch); please me find solution this.
this seems more of firewall/proxyserver issue.. make sure have port 443 open in server. make use of ping , curl command verify this.
see stack overflow issue more insight.
Comments
Post a Comment