第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

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

返回302,請教下哪里出問題了?

var?http?=?require('http');
var?querystring?=?require('querystring');
var?postData?=?querystring.stringify({
	'content':?'老師下次更新什么時候啊?',
	'cid':?348,
});

var?options?=?{
	hostname:?'idcbgp.cn',
	port:?80,
	path:?'/course/docoment',
	method:?'POST',
	headers:?{
		'Accept':'application/json,?text/javascript,?*/*;?q=0.01',
????????'Accept-Encoding':'gzip,?deflate',
????????'Accept-Language':'zh-CN,zh;q=0.8',
????????'Cache-Control':'no-cache',
????????'Connection':'keep-alive',
????????'Content-Length':postData.length,
????????'Content-Type':'application/x-www-form-urlencoded;?charset=UTF-8',
????????'Cookie':'//Cookie數(shù)據(jù)就不貼出來了,是直接復(fù)制粘貼過來的',
????????'Host':'idcbgp.cn',
????????'Origin':'http://idcbgp.cn',
????????'Pragma':'no-cache',
????????'Referer':'http://idcbgp.cn/comment/348',
????????'User-Agent':'Mozilla/5.0?(Windows?NT?10.0;?WOW64)?AppleWebKit/537.36?(KHTML,?like?Gecko)?Chrome/48.0.2564.116?Safari/537.36',
????????'X-Requested-With':'XMLHttpRequest'
	}
};

var?req?=?http.request(options,?function(res)?{
	console.log('Status:?'?+?res.statusCode);
	console.log('headers:?'?+?JSON.stringify(res.headers));
????//為data事件注冊回調(diào)函數(shù)來接受數(shù)據(jù)
	res.on('data',?function(chunk)?{
		console.log(Buffer.isBuffer(chunk));
		console.log(typeof?chunk);
	});
	//當(dāng)數(shù)據(jù)接受完畢,網(wǎng)絡(luò)連接關(guān)閉,觸發(fā)end事件
	res.on('end',?function()?{
		console.log('評論完畢!');
	});
});

//當(dāng)有錯誤發(fā)生時候
req.on('error',?function(e)?{
		console.log("error!?"?+?e.message);
});
//把要提交的數(shù)據(jù)寫入請求體
req.write(postData);
//完成請求
req.end();

代碼如上,node comment.js返回:

Status: 302

headers: {"server":"nginx","date":"Tue, 08 Mar 2016 06:51:41 GMT","content-type":"text/html","transfer-encoding":"chunked","connection":"keep-alive","expires":"Thu, 19 Nov 1981 08:52:00 GMT","cache-control":"no-store, no-cache, must-revalidate, post-check=0, pre-check=0","pragma":"no-cache","location":"/error/noexists"}

評論完畢!

看了好多遍代碼,不知道哪里出了問題,,求教一下

正在回答

1 回答

http://img1.sycdn.imooc.com//56e1314400018e6109060274.jpg

幾個點(diǎn):

1、是docomment不是docoment

2、應(yīng)該是mid,不是cid

3、mid的值請使用自己的

要復(fù)制代碼,評論之后,查看上圖的那個鏈接,復(fù)制里面的值(不要照抄視頻的信息)。

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

guihailiuli 提問者

非常感謝!
2016-03-10 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消
進(jìn)擊Node.js基礎(chǔ)(一)
  • 參與學(xué)習(xí)       219315    人
  • 解答問題       982    個

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

進(jìn)入課程

返回302,請教下哪里出問題了?

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號