diff --git a/index.js b/index.js index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..4b212b91211e3f2ef4c56db515e30161d8aaa801 100644 --- a/index.js +++ b/index.js @@ -0,0 +1,49 @@ +const axios = require('axios'); +const querystring = require('querystring'); + + + var headersData = { + "Accept-Encoding": "gzip, deflate, br", + "Accept-Language": "zh-CN,zh;q=0.9", + Connection: "keep-alive", + "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", + Host: "h5.hunlihu.com", + Origin: "https://s.hunlihu.com", + Referer: "https://s.hunlihu.com/", + "sec-ch-ua": "\".Not/A)Brand\";v=\"99\", \"Google Chrome\";v=\"103\", \"Chromium\";v=\"103\"", + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": "Windows", + "Sec-Fetch-Dest": "empty", + "Sec-Fetch-Mode": "cors", + "Sec-Fetch-Site": "same-site", + "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.66 Safari/537.36", + }; + let formData = { + 'auth': 'Lz8rzL8zzt', + 'jsons': `[{"d_name":"five123","user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.66 Safari/537.36","msg_type":"1","openid":"","nickname":"哈哈1","headimgurl":"","d_else":"新婚快乐 百年好合"}]` + + } +// 目标服务器地址和端口 +const options = { + // + hostname: 'https://h5.hunlihu.com', + path: '/vashow/ly/door/door/sign2', + method: 'POST', + headers: headersData +}; + +let url= "https://h5.hunlihu.com/vashow/ly/door/door/sign2"; + +// 将对象格式的数据转换为 x-www-form-urlencoded 格式 +const encodedData = querystring.stringify(formData); + +// 更新请求头中的 Content-Length +options.headers['Content-Length'] = Buffer.byteLength(encodedData); +axios.post(url, encodedData, { headers:options.headers }) + .then(response => { + console.log('请求成功,响应数据:', response.data); + }).catch((err)=>{ + + }) + + diff --git a/package.json b/package.json index e55eae98120fd5b39e30d83fc8d6789beef9803e..e019ce3d5fec42d1850022f7d8ae24045a8c1584 100644 --- a/package.json +++ b/package.json @@ -12,11 +12,13 @@ "license": "ISC", "dependencies": { "@types/node": "^18.0.6", + "axios": "^1.7.9", "body-parser": "^1.20.3", "express": "^4.21.2", "form-data": "^4.0.1", "http-proxy-middleware": "^3.0.3", "node-fetch": "^3.2.6", + "querystring": "^0.2.1", "request": "^2.88.2" } }