為啥評論不上去呢
var http = require('http');
var querystring = require('querystring');
var postData = querystring.stringify({
? ?content:'為啥測試不行呢',
? ?mid:8837
});
var options ={
? ?hostname:'www.xianlaiwan.cn',
? ?port:80,
? ?method:'POST',
? ?header:{
? ? ? ? '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':postData.length,
? ? ? ? 'Content-Type':'application/x-www-form-urlencoded; charset=UTF-8',
? ? ? ? 'Cookie':'imooc_uuid=5d61a8df-4545-4068-b291-2442c5f5b1b0; imooc_isnew_ct=1475583989; loginstate=1; apsid=JkYzVmOWEzY2E2NzJmYTNhZjhjNjUxNTc0MWEzMjIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMjYwNzg3MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA2MDk2NjYxNzRAcXEuY29tAAAAAAAAAAAAAAAAAAAAADBlODhhZjczMzY3ZTRkM2RjZGQwOTFiMmUzZDY5MTc5O6DzVzug81c%3DNT; last_login_username=609666174%40qq.com; PHPSESSID=6aoeqln2b6tts1pghbilmhl5n2; jwplayer.qualityLabel=è???; IMCDNS=0; imooc_isnew=2; cvde=57f65521190d6-21',
? ? ? ? 'Host':'www.xianlaiwan.cn',
? ? ? ? 'Origin':'http://www.xianlaiwan.cn',
? ? ? ? 'Referer':'http://www.xianlaiwan.cn/video/8837',
? ? ? ? 'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 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));
? ?res.on('data',function(chunk){
? ? ? ?console.log(Buffer.isBuffer(chunk));
? ? ? ?console.log(typeof chunk);
? ?});
? ?res.on('end',function(){
? ? ? ?console.log('END')
? ?})
});
req.on('error',function(err){
? ?console.log('ERROR :' + err.message )
});
req.write(postData);
req.end();
2016-10-08
不對 應該是變量header改成headers!
2016-11-21
有沒有封號
2016-10-08
報了什么錯誤?是postData里面的key不對?mid換成cid?