var http = require(‘http’);
var opt ={
host:’119.184.214.18’,
port:8080,
method:’GET’,
path:’http://42.96.192.46/echo_ip’,
headers:{
}
}
var body = '’;
var req=http.request(opt,function(res){
console.log("Got response: " + res.statusCode);
res.on('data’, function(d){
body += d;
}).on('end’,function(){
console.log(res.header);
console.log(body);
});
});
req.on('error’,function(e){ console.log(“Got error;” + e.message); });
req.end(); 为什么会报Parse Error??