亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

http改為https了 為什么還是沒有評論成功?

https://img1.sycdn.imooc.com//5bac7f860001f83e09560148.jpg

var??https=require("https");
var?querystring=require("querystring")
var?postData=querystring.stringify({
????'context':'測試數據最后一次!',
????'cid':348,
????'mid':8837,
})
var?options={
????protocol:'https:',
????hostname:'www.xianlaiwan.cn',
????port:443,
????path:'/course/docomment',
????method:'post',
????headers:{
????????'Accept':?'application/json,?text/javascript,?*/*;?q=0.01',
????????'Accept-Encoding':?'gzip,?deflate',
????????'Accept-Language':?'zh-CN,zh;q=0.9,en;q=0.8',
????????'Cache-Control':?'no-cache',
????????'Connection':?'keep-alive',
????????'Content-length':?postData.length,
????????'Cookie':'[]',
????????'Host':?'www.xianlaiwan.cn',
????????'Pragma':?'no-cache',
????????'Referer':?'http://www.xianlaiwan.cn/learn/348',
????????'User-Agent':?'Mozilla/5.0?(Macintosh;?Intel?Mac?OS?X?10_12_4)?AppleWebKit/537.36?(KHTML,?like?Gecko)?Chrome/69.0.3497.92?Safari/537.36',
????????'X-Requested-With':?'XMLHttpRequest'


????}


}

var??req=https.request(options,function?(res)?{
????console.log(res.statusCode)
????console.log(JSON.stringify(res.headers))
????res.on('data',?function(chunk){
????????console.log(Buffer.isBuffer(chunk));
????????console.log(typeof?chunk);
????});
????res.on('end',?function()?{
????????console.log('評論完畢');
????});
});
req.on('error',?function(e)?{
????console.log('Error'?+?e.message);
})

req.write(postData);
req.end();


正在回答

1 回答

nodejs 有專門的https的語法

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
進擊Node.js基礎(一)
  • 參與學習       219329    人
  • 解答問題       982    個

本視頻教程帶你揭開Node.js的面紗,帶你走進一個全新世界

進入課程

http改為https了 為什么還是沒有評論成功?

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號