The server is hosted in a cluster (I think that is what is called, when several domains are hosted with the same IP number)
Therefore it is not enough to just use an IPnumber.
ESP8266WiFi.init();
var net = require('net');
var hostname="ernstc.dk";
ESP8266WiFi.getHostByName(hostname, function(ipAddress){
var client=net.connect({host: ESP8266WiFi.getAddressAsString(ipAddress), port:80}, function() {
print('Connected');
client.write('GET /esp.txt HTTP/1.1\r\nHost:' +hostname+'\r\nAccept: */*\r\n\r\n');
client.on('data', function(data) {
print(data);
});
client.on('close', function() {
print('Connection closed');
});
});
});