dongqi9125 2013-05-14 14:21
浏览 676

针对Chrome错误500的Google Cloud Messaging

So I'm trying to send a message to a chrome extension through GCM, using php.

$data = json_encode(array(
        'channelId' => 'channel id here',
        'subchannelId' => '0',
        'payload'=>'test'
    ));

    $ch = curl_init();
    $curlConfig = array(
        CURLOPT_URL            => "https://www.googleapis.com/gcm_for_chrome/v1/messages",
        CURLOPT_POST           => true,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_POSTFIELDS     => $data,
        CURLOPT_SSL_VERIFYPEER => false,
        CURLOPT_HTTPHEADER     => array(
            'Authorization: Bearer ' . $access_token,
            'Content-Type: application/json'
        )
    );
    curl_setopt_array($ch, $curlConfig);
    $result = curl_exec($ch);

Each request returns { "error": { "code": 500, "message": null } }. Thanks.

  • 写回答

4条回答 默认 最新

  • doumao8355 2013-05-15 07:10
    关注

    500 is the HTTP error code for internal error.

    Sending a Google Cloud Message for Chrome from the Google oauthplayground website returns this for me:

    HTTP/1.1 500 Internal Server Error Content-length: 52 X-xss-protection: 1; mode=block X-content-type-options: nosniff X-google-cache-control: remote-fetch -content-encoding: gzip Server: GSE Reason: Internal Server Error Via: HTTP/1.1 GWA Cache-control: private, max-age=0 Date: Wed, 15 May 2013 07:01:40 GMT X-frame-options: SAMEORIGIN Content-type: application/json; charset=UTF-8 Expires: Wed, 15 May 2013 07:01:40 GMT { "error": { "code": 500, "message": null } }

    According to Google's Cloud Message for Chrome docs:

    An internal error has occurred. This indicates something went wrong on the Google server side (for example, some backend not working or errors in the HTTP post such as a missing access token).

    Essentially there's something wrong on Google's side of things. Considering Google I/O is going to start in a few hours I would assume they're currently making some changes.

    Try checking again in a few hours.

    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分