I'm trying get info from a external website, but i get this error:
getaddrinfo ENOTFOUND
My code is:
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 );
});
When i use this options:
var options = {
hostname: 'www.google.com',
port: 80,
path: '/index.html',
method: 'GET',
agent: false
};
It works well, but not with my domain or IP.
Thanks so much.
I got it!.
It was because I put http:// before the domain or IP address,
Now works with:
var options = {
host: 'DOMAIN_OR_IP_ADRESS',
port: 8080,
path: 'PARAMS_GET (I GUESS)',
method: 'GET',
agent: false
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With