system
September 26, 2009, 10:56pm
1
Hi,
I hope someone can help me. I have an arduino Ethernet shield, which connects ok with an HTML page in my domain, but cannot connect to a php page. (I have created a php page to gather Weather data in my location, and was hoping to feed back to Arduino).
I get the following error:
connecting...
connected
<!DOCTYPE html PUBLIC "-//W3C//DTD Xconnecting...
connected
<title>Error 500 - Internal server error</title>
disconnecting.
disconnecting.
and on my arduino:
client.println("GET /mypage.php");
client.println(" HTTP/1.1");
client.println();
Its driving me nuts....
Any tips?
system
September 26, 2009, 11:38pm
2
Does the php page work when you go it with your browser? The error 500 is a serverside one, and has nothing to do with the arduino
system
September 27, 2009, 11:47am
3
Yes it does. I'm basically getting all the information I need into 1 line of text.....
Do I need to convert my php page into HTML?
system
September 27, 2009, 10:48pm
4
I can also connect with the Arduino to other PHP pages OK. So annoying....
bhagman
September 28, 2009, 12:36am
5
Not exactly sure what the problem is, but one thing I see that may cause a problem is that you should either:
use HTTP/1.0 as protocol
or send a HOST: xxx header
HTTP/1.1 protocol requires that you send a HOST: header.
Also, it looks like you broke up the request line:
GET /mypage.php
HTTP/1.1
and it should be all on one line.
Just try this instead:
client.print[glow][s]ln[/s][/glow]("GET /mypage.php");
client.println(" HTTP/1.[glow]0[/glow]");
client.println();
Some web servers may be more forgiving about the HTTP protocol, and that's why they may be responding.
b
system
October 3, 2009, 4:41pm
6
For the record (in case anyone else comes across the same problem), this was solved using the following lines:
if (client.connect()) {
Serial.println("connected");
client.print("GET http://www ...../myfile.php?fname=19 HTTP/1.1 \n");
client.print("Host: www.arkadian.eu \n\n");
client.println();
}
Basically, 1and1 (like other hosts) require HTTP1.1 and a host before processing a php file.
The host can be any valid url.