const https = require("https");
var options = {
hostname: "web.4jc33.com",
port: 80,
path: "/lotts/times?ids=cqssc",
headers: {
"Content-Type": "application/json; charset=utf-8",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36",
"Referer": "https://web.4jc33.com/lotts/cqssc/index",
"Cookie": "guide1=xianyu; openSwitching=n657; JSESSIONID=4BA58696365A8AD51F0A5802A80D44306C693CEA"
},
};
https.get(options, (res) => {
console.log("statusCode:", res.statusCode);
console.log("headers:", res.headers);
res.on("data", (d) => {
process.stdout.write(d);
});
}).on("error", (e) => {
console.error(e);
});
//
{ Error: socket hang up
at TLSSocket.onHangUp (_tls_wrap.js:1135:19)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at TLSSocket.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1056:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
code: "ECONNRESET",
path: null,
host: "web.4jc33.com",
port: 80,
localAddress: undefined }
The code is as above. The link requesting https cannot be returned correctly, and the browser can open
.