0

在尝试通过 GCM 将我的消息从我的服务器发送到 Android 手机时

收到以下错误:

{"collapse_key":"update","registration_ids":["the reg I got from the phone"],"delay_while_idle":true,"data":{"info":"data_changed"}}, response is: $VAR1 = bless( {
                 '_content' => 'Can\'t connect to android.googleapis.com:443 (Network is unreachable)

LWP::Protocol::https::Socket: connect: Network is unreachable at /usr/local/share/perl5/LWP/Protocol/http.pm line 51.
',
                 '_rc' => 500,
                 '_headers' => bless( {
                                        'client-warning' => 'Internal response',
                                        'client-date' => 'Sun, 22 Sep 2013 18:23:10 GMT',
                                        'content-type' => 'text/plain',
                                        '::std_case' => {
                                                          'client-warning' => 'Client-Warning',
                                                          'client-date' => 'Client-Date'
                                                        }
                                      }, 'HTTP::Headers' ),
                 '_msg' => 'Can\'t connect to android.googleapis.com:443 (Network is unreachable)',
                 '_request' => bless( {
                                        '_content' => '{"collapse_key":"update","registration_ids":["the reg I got from the phone"],"delay_while_idle":true,"data":{"info":"data_changed"}}',
                                        '_uri' => bless( do{\(my $o = 'https://android.googleapis.com/gcm/send')}, 'URI::https' ),
                                        '_headers' => bless( {
                                                               'user-agent' => 'libwww-perl/6.05',
                                                               'content-type' => 'application/json; charset=UTF-8',
                                                               'content-length' => 266,
                                                               'authorization' => 'key=my api key'
                                                             }, 'HTTP::Headers' ),
                                        '_method' => 'POST'
                                      }, 'HTTP::Request' )
               }, 'HTTP::Response' );

我一直在尝试不同的东西,但无法让它工作我在我的服务器端使用 perl,但这不会影响这个问题,因为这是一个简单的 http post 请求,这似乎并不去工作

有人知道为什么会这样吗?

4

1 回答 1

0

想我会更新这个问题,这样就不会没有答案

问题是我忘记为用户代理定义“ ssl_opts ”参数,

意味着 https 验证没有正确完成

现在它工作正常:)

于 2013-10-06T08:42:06.570 回答