调用:
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不行。请各位大神指导下。多谢!