Apns php error “Failed to connect to APNS: 110 Con

2019-02-23 07:41发布

I have done apns code for php and objective c from this Apns code

and setup certificate from this link

Sandbox and production apns for sending notification to ios devices is working perfectly on my server.I moved code and same certificate to client server then sending notification is not working.

I debug all php code and found that it stops at this line of code

private function _connectSSLSocket($development) {
    $ctx = stream_context_create();
    stream_context_set_option($ctx, 'ssl', 'local_cert', $this->apnsData[$development]['certificate']);
    $this->sslStreams[$development] = stream_socket_client($this->apnsData[$development]['ssl'], $error, $errorString, 100, (STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT), $ctx);
    if(!$this->sslStreams[$development]){
        $this->_triggerError("Failed to connect to APNS: {$error} {$errorString}.");
        unset($this->sslStreams[$development]);
        return false;
    }
    return $this->sslStreams[$development];
}

apns.log file shows the error "Failed to connect to APNS: 110 Connection timed out."

Not getting the mistake. Why this error am i getting and not sending notification to ios devices ? Can anyone guide me for this ?

1条回答
我欲成王,谁敢阻挡
2楼-- · 2019-02-23 08:11

Finally i took vps instead of shared hosting. Lucabro's comments helped me to solve. Thanks Lucabro.

查看更多
登录 后发表回答