GCM错误或curl语法不正确?
我执行以下命令:GCM错误或curl语法不正确?,curl,syntax,google-cloud-messaging,Curl,Syntax,Google Cloud Messaging,我执行以下命令: curl --header "Authorization: key=$api_key" --header Content-Type:"application/json" https://android.googleapis.com/gcm/send -d "{\"registration_ids\":[\"ABC\"]}" 得到这个: <HTML> <HEAD> <TITLE>Moved Temporarily</TITLE>
curl --header "Authorization: key=$api_key" --header Content-Type:"application/json" https://android.googleapis.com/gcm/send -d "{\"registration_ids\":[\"ABC\"]}"
得到这个:
<HTML>
<HEAD>
<TITLE>Moved Temporarily</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Moved Temporarily</H1>
The document has moved <A HREF="http://developer.android.com/guide/google/gcm/">here</A>.
</BODY>
</HTML>
curl: (6) Could not resolve host: -d; nodename nor servname provided, or not known
curl: (3) [globbing] nested braces not supported at pos 21
暂时搬家
暂时搬家
文档已移动。
curl:(6)无法解析主机:-d;提供了nodename或servname,或未知
卷曲:(3)[全局]位置21处不支持嵌套大括号
curl命令的语法是否不正确,还是与Google服务器有关?首先获取GCM API密钥:
完成以下过程。
步骤#1:使用您的谷歌帐户登录
步骤2:在左侧的导航中,进入“API&auth>API”
步骤#3:找到“Android版谷歌云消息”,然后单击旁边的“关闭”按钮(注意:这可能涉及同意附加服务条款)
步骤4:在左侧的导航中,进入“API&auth>注册应用程序”
第五步:显然,要等很长时间
第6步:单击红色注册应用程序按钮
步骤7:为应用程序命名并选择Web应用程序,然后单击注册
步骤8:单击服务器密钥的“服务器密钥”部分
然后获取设备通知ID
curl--header“Authorization:key=XXXXXXX”-header内容类型:“application/json”-d“{\'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\\”:[\'ABC\']}”我得到了同样的结果