为了账号安全,请及时绑定邮箱和手机立即绑定

报错:Errorgetaddrinfo ENOTFOUND http://www.imooc.com http://www.imooc.com:80 求解!!!

报错:Errorgetaddrinfo ENOTFOUND http://www.imooc.com http://www.imooc.com:80 求解!!!

DYD_study 2017-10-04 16:14:34
var http = require('http');var querystring = require('querystring');var postData = querystring.stringify({ 'content': '慕课网66666(test~test~test~)', 'cid': 8837});var options = { hostname: 'http://www.imooc.com', 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', 'Content-Length': postData.length, 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'Cookie': 'PHPSESSID=jborgj9jedn0sv7b5b70l570s1; imooc_uuid=6b71cd9c-5134-4a73-9739-bb6c390ba12b; imooc_isnew=1; imooc_isnew_ct=1507100666; loginstate=1; apsid=IxZGFkOTYyYzUyYmI2ZTNkNjhkMWYwZmU5YTdkZGIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMzA2NzY3MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABzdXBlcm1hbmR5ZEBzaW5hLmNvbQAAAAAAAAAAAAAAADE1YzZhYzQ3MDMwZjYzY2JmNTVjNjE0NzI3ZWZjMTNmR4jUWUeI1Fk%3DYm; last_login_username=supermandyd%40sina.com; Hm_lvt_f0cfcccd7b1393990c78efdeebff3968=1507100667; Hm_lpvt_f0cfcccd7b1393990c78efdeebff3968=1507100743; cvde=59d487faa24a0-10', 'Host': 'http://www.imooc.com', 'Origin': 'http://www.imooc.com', 'Proxy-Connection': 'keep-alive', 'Referer': 'http//www.imooc.com/video/8837', 'User-Agent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Mobile 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('评论完毕!'); });});req.on('error', function(e){ console.log('Error' + e.message);});req.write(postData);req.end();
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 5796 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信