I figured this out. Here is complete code on how to turn on and off leds based on post response from a seperate web server...
#define WEBDUINO_FAIL_MESSAGE "<h1>Request Failed</h1>"
#include "Ethernet.h"
#include "WebServer.h"
#define VERSION_STRING "0.1"
/* CHANGE THIS TO YOUR OWN UNIQUE VALUE. The MAC number should be
* different from any other devices on your network or you'll have
* problems receiving packets. */
static uint8_t mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
/* CHANGE THIS TO MATCH YOUR HOST NETWORK. Most home networks are in
* the 192.168.0.XXX or 192.168.1.XXX subrange. Pick an address
* that's not in use and isn't going to be automatically allocated by
* DHCP from your router. */
static uint8_t ip[] = { 192, 168, 1, 64 };
int led[14] = {22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35};
// ROM-based messages used by the application
// These are needed to avoid having the strings use up our limited
// amount of RAM.
P(Page_start) = "<html><head><title>Web_Parms_1 Version " VERSION_STRING "</title></head><body>\n";
P(Page_end) = "</body></html>";
P(Get_head) = "<h1>GET from >";
P(Post_head) = "<h1>POST to ";
P(Unknown_head) = "<h1>UNKNOWN request for ";
P(Default_head) = "unidentified URL requested.</h1>
\n";
P(Raw_head) = "raw.html requested.</h1>
\n";
P(Parsed_head) = "parsed.html requested.</h1>
\n";
P(Good_tail_begin) = "URL tail = '";
P(Bad_tail_begin) = "INCOMPLETE URL tail = '";
P(Tail_end) = "'
\n";
P(Parsed_tail_begin) = "URL parameters:
\n";
P(Parsed_item_separator) = " = '";
P(Params_end) = "End of parameters
\n";
P(Post_params_begin) = "Parameters sent by POST:
\n";
P(Line_break) = "
\n";
P(test) = "test";
/* This creates an instance of the webserver. By specifying a prefix
* of "", all pages will be at the root of the server. */
#define PREFIX ""
WebServer webserver(PREFIX, 80);
/* commands are functions that get called by the webserver framework
* they can read any posted data from client, and they output to the
* server to send data back to the web browser. */
void helloCmd(WebServer &server, WebServer::ConnectionType type, char *url_tail, bool tail_complete)
{
/* this line sends the standard "we're all OK" headers back to the
browser */
server.httpSuccess();
/* if we're handling a GET or POST, we can output our data here.
For a HEAD request, we just stop after outputting headers. */
if (type == WebServer::HEAD)
return;
server.printP(Page_start);
switch (type)
{
case WebServer::GET:
server.printP(Get_head);
break;
case WebServer::POST:
server.printP(Post_head);
break;
default:
server.printP(Unknown_head);
}
server.printP(Default_head);
server.printP(tail_complete ? Good_tail_begin : Bad_tail_begin);
server.print(url_tail);
server.printP(Tail_end);
server.print("hello");
server.printP(Page_end);
}
void rawCmd(WebServer &server, WebServer::ConnectionType type, char *url_tail, bool tail_complete)
{
/* this line sends the standard "we're all OK" headers back to the
browser */
server.httpSuccess();
/* if we're handling a GET or POST, we can output our data here.
For a HEAD request, we just stop after outputting headers. */
if (type == WebServer::HEAD)
return;
server.printP(Page_start);
switch (type)
{
case WebServer::GET:
server.printP(Get_head);
break;
case WebServer::POST:
server.printP(Post_head);
break;
default:
server.printP(Unknown_head);
}
server.printP(Raw_head);
server.printP(tail_complete ? Good_tail_begin : Bad_tail_begin);
server.print(url_tail);
server.printP(Tail_end);
server.print("raw");
server.printP(Page_end);
}
#define NAMELEN 32
#define VALUELEN 32
void parsedCmd(WebServer &server, WebServer::ConnectionType type, char *url_tail, bool tail_complete)
{
URLPARAM_RESULT rc;
char name[NAMELEN];
int name_len;
char value[VALUELEN];
int value_len;
/* this line sends the standard "we're all OK" headers back to the
browser */
server.httpSuccess();
/* if we're handling a GET or POST, we can output our data here.
For a HEAD request, we just stop after outputting headers. */
if (type == WebServer::HEAD)
return;
server.printP(Page_start);
switch (type)
{
case WebServer::GET:
server.printP(Get_head);
break;
case WebServer::POST:
server.printP(Post_head);
break;
default:
server.printP(Unknown_head);
}
server.printP(Parsed_head);
server.printP(tail_complete ? Good_tail_begin : Bad_tail_begin);
server.print(url_tail);
server.printP(Tail_end);
server.print("ttt");
if (strlen(url_tail))
{
server.printP(Parsed_tail_begin);
while (strlen(url_tail))
{
rc = server.nextURLparam(&url_tail, name, NAMELEN, value, VALUELEN);
if (rc == URLPARAM_EOS)
server.printP(Params_end);
else
{
server.print(name);
server.printP(Parsed_item_separator);
server.print(value);
server.printP(Tail_end);
// This is the spot to put the code!!!!!!!!!
int L = 0;
if ( name[0] == 'a' )
L = 0;
else if ( name[0] == 'b' )
L = 5;
else if ( name[0] == 'c' )
L = 10;
int a = atoi(value);
if ( a == 1 )
digitalWrite(led[L], HIGH);
else if ( a == 0 )
digitalWrite(led[L], LOW);
}
}
}
if (type == WebServer::POST)
{
server.printP(Post_params_begin);
while (server.nextURLparam(&url_tail, name, NAMELEN, value, VALUELEN))
{
server.print(name);
server.printP(Parsed_item_separator);
server.print(value);
server.printP(Tail_end);
server.print("parse");
}
}
server.printP(Page_end);
}
void my_failCmd(WebServer &server, WebServer::ConnectionType type, char *url_tail, bool tail_complete)
{
/* this line sends the standard "we're all OK" headers back to the
browser */
server.httpFail();
/* if we're handling a GET or POST, we can output our data here.
For a HEAD request, we just stop after outputting headers. */
if (type == WebServer::HEAD)
return;
server.printP(Page_start);
switch (type)
{
case WebServer::GET:
server.printP(Get_head);
break;
case WebServer::POST:
server.printP(Post_head);
break;
default:
server.printP(Unknown_head);
}
server.printP(Default_head);
server.printP(tail_complete ? Good_tail_begin : Bad_tail_begin);
server.print(url_tail);
server.printP(Tail_end);
server.print("fail");
server.printP(Page_end);
}
void setup()
{
/* initialize the Ethernet adapter */
Ethernet.begin(mac, ip);
/* setup our default command that will be run when the user accesses
* the root page on the server */
webserver.setDefaultCommand(&helloCmd);
/* setup our default command that will be run when the user accesses
* a page NOT on the server */
webserver.setFailureCommand(&my_failCmd);
/* run the same command if you try to load /index.html, a common
* default page name */
webserver.addCommand("index.html", &helloCmd);
/*This command is called if you try to load /raw.html */
webserver.addCommand("raw.html", &rawCmd);
webserver.addCommand("parsed.html", &parsedCmd);
/* start the webserver */
webserver.begin();
for ( int i = 0; i < 14; i++ )
pinMode(led[i], OUTPUT);
}
void loop()
{
char buff[64];
int len = 64;
/* process incoming connections one at a time forever */
webserver.processConnection(buff, &len);
}
Code for web site.....
<form id="addUser" name="addUser" method="GET" action="http://192.168.1.64/parsed.html" >
V1 ON<input type="checkbox" name="a" value="1" />
OFF<input type="checkbox" name="a" value="0" />
V2 ON<input type="checkbox" name="b" value="1" />
OFF<input type="checkbox" name="b" value="0" />
V3 ON<input type="checkbox" name="c" value="1" />
OFF<input type="checkbox" name="c" value="0" />
<input type="submit" value="update" />
</form>
I hope this helps someone else out....