Query on reading string in the URL for web server (URGENT)

First of all, i am a Arduino beginner that i have just read a online tutorial from instructable which is talking about how to make use of a W5100 Ethernet Shield to construct a web server.

Here is the tutorial.

I have tested the work example of using string ‘$1’ and ‘$2’ to control the LED on the board. ( The work example of web server)

The programme works, but then however i would like to adjust it a bit.
I would like to use command string like ‘$ledon’ and ‘$ledoff’ to control the LED. Later, i find it difficult to change the codes to achieve this.

I would be appreciated for any help for the problem. Thank You.

Here is the coding of the original function:

#include <SPI.h>
#include <Ethernet.h>

boolean incoming = 0;

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac = { 0x00, 0xAA, 0xBB, 0xCC, 0xDA, 0x02 };
IPAddress ip(191,11,1,1); //<<< ENTER YOUR IP ADDRESS HERE!!!

// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
EthernetServer server(80);

void setup()
pinMode(2, OUTPUT);

// start the Ethernet connection and the server:
Ethernet.begin(mac, ip);

void loop()
// listen for incoming clients
EthernetClient client = server.available();
if (client) {
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
// if you’ve gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so you can send a reply

//reads URL string from $ to first blank space
if(incoming && c == ’ '){
incoming = 0;
if(c == ‘$’){
incoming = 1;

//Checks for the URL string $1 or $2
if(incoming == 1){

if(c == ‘1’){
digitalWrite(2, HIGH);
if(c == ‘2’){
digitalWrite(2, LOW);


if (c == ‘\n’) {
// you’re starting a new line
currentLineIsBlank = true;
else if (c != ‘\r’) {
// you’ve gotten a character on the current line
currentLineIsBlank = false;
// give the web browser time to receive the data
// close the connection:

My server code breaks out the request line of the header into variables. You should be able to parse out what you need from that.