create a connection between Arduino and a Webserver-folder

hello erveryone,

i want to download a txt-file from my webserver. DocumetRoot: [u]Webserver[/u]/website/test/konfig.txt

Therefore i need a connetion via...

EthernetClient MySystem_InitializeServerConnection(byte server[], int port, char location[]) {

EthernetClient ethClient;

ethClient.connect(server, port);

if(ethClient.connected()) { // HTTP request: ethClient.print("GET "); ethClient.print(location); ethClient.println(" HTTP/1.1"); ethClient.print("Host: "); ethClient.print(server[0]+'.'+server[1]+'.'+server[2]+'.'+server[3]);


ethClient.println("Connection: close"); ethClient.println(); Serial.println("CONNECTED"); } else { Serial.println("NO CONNECTION"); }

return ethClient; }

The config is:

byte KonfigServerURL [] = {192,168,2,151}; // Konfigurationsserver, z.B. [] oder IP-Adresse (192.168.X.X für lokales Netzwerk), kein http:// angeben char KonfigRelativeWebPage [] = "/website/TEST/Konfig-Blech.txt"; // Realtive Webseite mit Konfiguration: /Konfig-Blech.txt, /Konfig-Oberfläche.txt, /Konfig-Polen.txt

byte MAC_Arduino[6] = { 0x90, 0xA2, 0xDA, 0x0F, 0x9F, 0xE5 }; // MAC-Adresse vom Arduino byte IP_Arduino [4] = {192,168,2,222}; // IP vom Arduino byte SBNM_Arduino [4] = {255,255,255,0}; // Subnetzmaske für IP des Arduino byte GW_Arduino [4] = {192,168,2,1}; // Gateway für Arduino byte DNS_Arduino [4] = {192,168,2,1}; // DNS für Arduino

I don't get an connection!!! please help. Thanks!


in the folder above I have an .htaccess-file. i think i need an authentification sequence in the header. how should that look like?

P.S.: without the .htaccess-file it it will not work either

please help

Without seeing ALL of your code? Not much chance of that.

How is the Arduino connected to the internet?

Try this WebServer Tutorial and see if you can connect to it, so we can exclude internet problems.

The rest, as PaulS said, only posting your full code, because the error can, and normally is, outside the posted snippet.