我按照課程上的發(fā)送評(píng)論但是每次控制臺(tái)都會(huì)報(bào)errorsocket?hang?up,代碼和視頻上的講的一樣,請(qǐng)問這是什么原因?
/**
?*?Created?by?hp?on?2017/3/19.
?*/
var?http=require('http');
var?querystring=require('querystring');
var?postData=querystring.stringify({
???'content':'老師講的挺好',
???'cid':348
});
var?options={
????hostname:'idcbgp.cn',
????port:80,
????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.8',
????????'Connection':'keep-alive',
????????'Content-Length':'133',
????????'Content-Type':'application/x-www-form-urlencoded;?charset=UTF-8',
????????'Cookie':'imooc_uuid=01708583-afe9-4af8-b0e4-70e126d49aea;?imooc_isnew_ct=1476869310;?PHPSESSID=d2oh48v48v6ase1l3fqv71c6t2;?loginstate=1;?apsid=Y2ZDhkNjgyOTgwZDYzY2JhOTUyZjBlNTViYmIyMTQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMzk2MDIxNwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGM5Y2U3MTIxNDkwN2FmZTllODAzODBiZGRlMGFiODdi%2FAHOWPwBzlg%3DNW;?Hm_lvt_f0cfcccd7b1393990c78efdeebff3968=1489895554;?Hm_lpvt_f0cfcccd7b1393990c78efdeebff3968=1489909296;?IMCDNS=0;?imooc_isnew=2;?cvde=58ce00803afc4-146',
????????'Host':'idcbgp.cn',
????????'Origin':'http://idcbgp.cn',
????????'Referer':'http://idcbgp.cn/comment/348',
????????'User-Agent':'Mozilla/5.0?(Windows?NT?10.0;?WOW64)?AppleWebKit/537.36?(KHTML,?like?Gecko)?Chrome/54.0.2840.59?Safari/537.36',
????????'X-Requested-With':'XMLHttpRequest'
????}
};
var?req=http.request(options,function(res){
????console.log('status+'+res.statusCode)
????res.on('data',function(chunk){
????????console.log('正在返回')
????});
????res.on('end',function(){
????????console.log('評(píng)論完畢')
????})
});
req.on('error',function(e){
????console.log('error'+?e.message)
});
req.write(postData);
req.end();
2022-03-24
物理原理就是與門,或門,非門這些電子電路。筆記是給自己看或者記錄的,討論是用來(lái)交流和提問的。