I wanted to read a POST like you instead of using a GET.
I did it like this:
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0X52, 0X64, 0X75, 0X69, 0X6E, 0X6F };
IPAddress ip( 192,168,0,97 );
EthernetServer server(80);
char new_state[1024];
void setup()
{
Serial.begin(9600);
Ethernet.begin(mac, ip);
server.begin();
for (int pin = 2; pin <= 9; pin++) {
pinMode(pin, OUTPUT);
}
Serial.print("Serving on http://");
Serial.println(Ethernet.localIP());
}
void loop()
{
EthernetClient client = server.available();
if (client) {
while (client.connected()) {
int i = 0;
int head = 1;
int body = 0;
while(client.available()) {
char c = client.read();
if (c == '\n') {
if ( i <= 2 ) {
sendPage(client);
if ( head == 1 ) {
body = 1;
head = 0;
}
}
i = -1;
}
if ( body == 1 ) {
new_state[i] = c;
}
i++;
new_state[i] = '\0';
}
i = 0;
}
if ( strncmp( new_state, "pinD", 4) == 0 ) {
int pin = new_state[4] - 48;
if ( strncmp( new_state+5, "=On", 3) == 0 ) {
digitalWrite(pin, 1);
}
else if ( strncmp( new_state+5, "=Off", 4) == 0 ) {
digitalWrite(pin, 0);
}
}
}
}
void sendPage(EthernetClient client)
{
client.println("HTTP/1.0 200 OK\Content-Type: text/html\n\n<html>\n<head>");
client.println("<link rel='icon' href='data:;base64,iVBORw0KGgo='>");
client.println("<title>POST Pin controller</title>\n</head>\n<body>\n");
client.println("<h2>Buttons turn pins on or off</h2>");
client.println("<form method='post' action='/' name='pins'>");
char line[1024];
int pin;
for ( pin=2; pin<=9; pin++ ) {
sprintf(line, "<input name='pinD%d' type='submit' value='On' />\n", pin);
client.print(line);
sprintf(line, "<input name='pinD%d' type='submit' value='Off' /> %d<br />\n", pin, pin);
client.print(line);
}
client.println("</form>\n</body>\n</html>");
client.stop();
}
There are ways to do it which are simpler and smaller, but I found them quite laggy so have been trying to get it as fast as possible.
I have used this to control 8 LEDs on pins 2-9 on a Mega 2560.
I haven't tested it on a Uno yet, but I expect it would work the same.