【发布时间】:2016-12-16 15:54:22
【问题描述】:
我已通过\Zend\Http\ 客户端将GCM 与laravel 5.1 PushNotification 连接起来。
它工作得很好。但突然它停止工作并产生一些exceptions。
我的代码就像...
$collection = PushNotification::app('appNameAndroid')->to ( $deviceToken );
$collection->adapter->setAdapterParameters(['sslverifypeer' => false]);
$collection->send ( $message );
我也尝试了以下代码,但它们都不起作用...
$collection = PushNotification::app('appNameAndroid')->to ( $deviceToken );
$new_client = new \Zend\Http\Client(null, array(
'adapter' => 'Zend\Http\Client\Adapter\Socket',
'sslverifypeer' => false
));
$collection->adapter->setHttpClient($new_client);
$collection->send ( $message );
----------------------------and-----------------------------------
$collection = PushNotification::app('appNameAndroid')->to ( $deviceToken );
$collection->adapter->setAdapterParameters(array(
'ssl'=>array(
'verify_peer' => false,
'verify_peer_name' => false)
));
$collection->send ( $message );
例外是......
exception 'ErrorException' with message 'stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:14077102:SSL routines:SSL23_GET_SERVER_HELLO:unsupported protocol' in C:\xampp\htdocs\activ8-webapp\api\vendor\zendframework\zend-http\src\Client\Adapter\Socket.php:281
Next exception 'Zend\Http\Client\Adapter\Exception\RuntimeException' with message 'Unable to enable crypto on TCP connection gcm-http.googleapis.com' in C:\xampp\htdocs\activ8-webapp\api\vendor\zendframework\zend-http\src\Client\Adapter\Socket.php:308
【问题讨论】:
标签: php laravel-5 push-notification google-cloud-messaging ssl-certificate