const https = require('https');
const querystring = require('querystring');
 
 
const postData = querystring.stringify({
    name: '백충덕',
    type: 'admin'
});
 
const opt = {
    hostname: 'hostname.com',
    port: 443,
    path: '/path/to',
    method: 'POST',
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
        'Content-Length': postData.length
    }
};
const req = https.request(opt, (res)=>{
    let buf = '';
    res.on('data', (data)=>{
        buf += data;
    });
    res.on('end', ()=>{
        console.log(JSON.parse(buf));
    });
});
req.write(postData);
req.end();

 

 

 

 

 

 

Posted by bloodguy

댓글을 달아 주세요