Hallo Forum,
mein WLAN Shield (Redfly sagt leider kein Mucks mehr), daher musste fix ein Ethernet - Shield her (in Berlin regnet es ja fast den ganzen Tag). Doch leider will das nicht so wie ich es will.
Nachdem das WebServer-Beispiel tadellos funktioniert und auch das WebClient-Beispiel so will wie es soll, will leider mein eigenes Beispiel nicht:
Ich erhalte lediglich ein Bad Request.
Kann ich anstelle der Server IP nicht einfach die Domain übergeben?
#include <SPI.h>
#include <Ethernet.h>
// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //meine MAC noch nicht eingegeben
IPAddress server(85,25,245,16); // www.hemitheconyx-caudicinctus.de !!!!Ich lande jedoch auf der Startseite der Adminoberfläche
// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;
void setup() {
// start the serial library:
Serial.begin(9600);
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// no point in carrying on, so do nothing forevermore:
for(;;)
;
}
// give the Ethernet shield a second to initialize:
delay(1000);
Serial.println("connecting...");
// if you get a connection, report back via serial:
if (client.connect(server, 85)) {
Serial.println("connected");
// Make a HTTP request:
client.println("GET /hc_arduino_php/test.php HTTP/1.0"); //www.hemitheconyx-caudicinctus.de =>www.hemitheconyx-caudicinctus.de/hc/ !!!Aktive Umleitung
client.println();
}
else {
// kf you didn't get a connection to the server:
Serial.println("connection failed");
}
}
void loop()
{
// if there are incoming bytes available
// from the server, read them and print them:
if (client.available()) {
char c = client.read();
Serial.print(c);
}
// if the server's disconnected, stop the client:
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
// do nothing forevermore:
for(;;)
;
}
}
Vielen Dank und ein schönes WE wünschend
Balli