跳到主要内容
CNode

有人做过node https发送post请求?错误提示unknown protocol:openssl\ssl\s23_clnt.c:766:

社区
Aadam1985发布于 12 年前最后回复 12 年前
2157900

D:\node\weishi>node post problem with request: 8820:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:un known protocol:openssl\ssl\s23_clnt.c:766:

代码 var https = require('https'); var options = { hostname: 'open.t.qq.com', port: 80, path: '/api/auth/token', method: 'POST' }; var req = https.request(options, function (response) { var str = ''; response.on('data', function (data) { str = str + data; }); response.on('end', function () { console.log(str); }); }); req.on('error', function (e) { console.log('problem with request: ' + e.message); }); //req.write(""); req.end();

查看回复

回复 (2)

L
leapon#112 年前

https 默认端口是 443,你的 options 里用的是 80 端口,可能是这个?

参与回复

登录后即可参与回复。登录