const http = require('http'); const https = require('https'); /** * Script kiểm tra API giải captcha với Proxy * Hỗ trợ cả HTTP và HTTPS, tự động chọn module phù hợp */ async function testCaptchaWithProxy() { const API_URL = 'https://kinxsoftware.online/api/solve'; const API_KEY = 'f064b7bf-8bcc-47f4-befe-1831540cffa5'; const PROXY = 'http://zlet9i3y:oZJQ0o4V@157.10.49.215:44128'; const postData = JSON.stringify({ action: 'FLOW_GENERATION', proxy: PROXY }); const url = new URL(API_URL); const isHttps = url.protocol === 'https:'; const transport = isHttps ? https : http; const options = { hostname: url.hostname, port: url.port || (isHttps ? 443 : 80), path: url.pathname, method: 'POST', headers: { 'Content-Type': 'application/json', 'x-api-key': API_KEY, 'Content-Length': Buffer.byteLength(postData) }, // Bỏ qua kiểm tra SSL nếu là localhost hoặc server tự cấp chứng chỉ rejectUnauthorized: false }; console.log('--- Đang gửi yêu cầu giải captcha với Proxy ---'); console.log('URL:', API_URL); console.log('Proxy:', PROXY); const req = transport.request(options, (res) => { let data = ''; res.on('data', (chunk) => { data += chunk; }); res.on('end', () => { console.log('Phản hồi từ Server:', res.statusCode); try { const jsonResponse = JSON.parse(data); console.log('Kết quả:', JSON.stringify(jsonResponse, null, 2)); } catch (e) { console.log('Phản hồi không phải JSON:', data); } }); }); req.on('error', (e) => { console.error('Lỗi kết nối:', e.message); }); req.write(postData); req.end(); } testCaptchaWithProxy();