2
我試圖獲得來自外部網站的信息,但我得到這個錯誤:我得到ENOTFOUND Node.js的與IP地址
getaddrinfo ENOTFOUND
我的代碼是:
var options = {
host: 'http://DOMAIN_OR_IP_ADRESS/',
port: 8080,
path: 'PARAMS_GET (I GUESS)',
method: 'GET',
agent: false
};
http.get(options, function(resp){
resp.on('data', function(chunk){
console.log(chunk);
});
}).on("error", function(e){
console.log("Error: http://IP_OR_DOMAIN" + "\n" + e.message);
console.log(e.stack);
});
當我使用此選項:
var options = {
hostname: 'www.google.com',
port: 80,
path: '/index.html',
method: 'GET',
agent: false
};
它w orks很好,但不適合我的域名或IP。
非常感謝。
我也有這個問題,如果我把/ IP地址後。 –