heckler_kwan 2017-03-23 02:44 采纳率: 0%
浏览 2800

linux的curl获取微信的access_token时,服务器返回200,但不带任何json信息?

调用:
curl -X \
GET "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential\&appid=wxAppIDwxAppID\&secret=WeixinSecretWeixinSecretWeixinSecret" \
--anyauth \
-0 \
-v \
-k \
-H "Host: api.weixin.qq.com" \
-H "Accept: text/html, text/plain, text/sgml, text/css, application/xhtml+xml, /;q=0.01" \
-H "Accept-Encoding: gzip, compress, bzip2" \
-H "Accept-Language: en" \
-H "User-Agent: Lynx/2.8.9dev.1 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/3.3.8" \


curl过程信息:

  • Hostname was NOT found in DNS cache
  • Trying 183.weixin.ipaddress...
  • Connected to api.weixin.qq.com (183.weixin.ipaddress) port 443 (#0)
  • successfully set certificate verify locations:
  • CAfile: none CApath: /etc/ssl/certs
  • SSLv3, TLS handshake, Client hello (1):
  • SSLv3, TLS handshake, Server hello (2):
  • SSLv3, TLS handshake, CERT (11):
  • SSLv3, TLS handshake, Server key exchange (12):
  • SSLv3, TLS handshake, Server finished (14):
  • SSLv3, TLS handshake, Client key exchange (16):
  • SSLv3, TLS change cipher, Client hello (1):
  • SSLv3, TLS handshake, Finished (20):
  • SSLv3, TLS change cipher, Client hello (1):
  • SSLv3, TLS handshake, Finished (20):
  • SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
  • Server certificate:
  • subject: C=CN; ST=Guangdong; L=Shenzhen; O=Shenzhen Tencent Computer Systems Company Limited; OU=R&D; CN=mp.weixin.qq.com
  • start date: 2016-10-31 00:00:00 GMT
  • expire date: 2018-01-29 23:59:59 GMT
  • issuer: C=US; O=GeoTrust Inc.; CN=GeoTrust SSL CA - G3
  • SSL certificate verify ok. > GET /cgi-bin/token?grant_type=client_credential&appid=wxAppIDwxAppID&secret=WeixinSecretWeixinSecretWeixinSecret HTTP/1.0 > Host: api.weixin.qq.com > Accept: text/html, text/plain, text/sgml, text/css, application/xhtml+xml, /;q=0.01 > Accept-Encoding: gzip, compress, bzip2 > Accept-Language: en > User-Agent: Lynx/2.8.9dev.1 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/3.3.8 >
  • HTTP 1.0, assume close after body < HTTP/1.0 200 OK < Connection: close < Cache-Control: no-cache, must-revalidate < Content-Type: text/html; charset=gbk < Content-Length: 0 <
  • Closing connection 0
  • SSLv3, TLS alert, Client hello (1):

用IE、Chrome甚至Lynx都可以获得access_token的返回json数据;就是用curl不行。请各位大神指导下。多谢!

  • 写回答

1条回答 默认 最新

  • 关注
    评论

报告相同问题?

悬赏问题

  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler