Hi to all, and thanks in advance to anyone can help me.
I'm trying to realize an integration between Arduino and my Web server Apache running on my laptop. In particular I'm trying to make my arduino code launch a Web Service on my web server to insert a nel line on my mysql db.
I've the following configuration HW+SW.
- Arduino Uno + Ethernet Shield
- On my laptop I'm running the following configuration of XAMPP
Apache 2.2.14
MySQL 5.1.41
PHP 5.3.1 - Arduino IDE 0022 to develope
My actual SW is the following:
- On Arduino:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { YYY,YYY,YYY,YYY };
//byte server[] = { 173,194,33,104 }; // Google
//byte server[] = { XXX,XXX,XXX,XXX }; // Mio sito
byte server[] = { 127,0,0,1 }; // Mio sito
//byte server[] = { localhost }; // Mio sito
Client client(server, 80);
void setup() {
Ethernet.begin(mac, ip);
Serial.begin(9600);
delay(1000);
Serial.println("connecting...");
// if you get a connection, report back via serial:
if (client.connect()) {
Serial.println("connected");
// Make a HTTP request:
//client.println("GET connessione su google HTTP/1.0"); //Su google - it works
client.println("GET connessione mio web server HTTP/1.0"); // on my website - it doesn't work
client.println();
}
else {
// if you didn't get a connection to the server:
Serial.println("connection failed");
}
}
Unfortunately on Arduino serial monitor I receive:
connecting...
connection failed
disconnecting.
It's very strange for the following reasons:
-
If I lauch the same instruction with a normal browser
it works, the exposed web service works and I find a new row on my Database. -
If I let the sketch run, specifying google server (173,194,33,104) as destination and
client.println("GET /search?q=Arduino HTTP/1.0");
as instruction, it works well, and I've the correct return in my serial monitor. I already exeperimeted all possibile server configuration (localhost, 127.0.0.1, XXX.XXX.XXX.XXX) -
I think my Apache web server is working properly because I've set the log level to max and in my logs, at restart I have
[Thu Dec 30 10:52:39 2010] [notice] Child 4012: Starting thread to listen on port 443.
[Thu Dec 30 10:52:39 2010] [notice] Child 4012: Starting thread to listen on port 80.
[Thu Dec 30 10:52:39 2010] [notice] Child 4012: Starting thread to listen on port 443.
[Thu Dec 30 10:52:39 2010] [notice] Child 4012: Starting thread to listen on port 80.
so it seems to listen at the right port
and because when I launch the instruction in the web browser in my access.log file, I have normal connection rows in the access.log
I really don't know what else to do.
I hope someone can help me.