Using web client data as value

Hello guys i am looking for a solution for long time, i found and tried a lot samples but didn't work.

My Question is:

For example i created a text file and wrote abcd into that. After i uploaded it to a web server, www.domain.com/mytext.txt

string test1 = "abcd"

string test2 = text of in the www.domain.com/mytext.txt

 if (test1 == test2 ) { 
         Serial.println("okay"); 
      }else{
                 Serial.println("not okay"); 
      }

if test1 and text of in the www.domain.com/mytext.txt are same, i want to serial print okay.

How can i do that?

How can i do that?

Be aware that a lot more of other stuff is returned from the server besides just what is in the text file. If the contents of the text file is very small, you might capture what is returned then perform a test to see if the desired character string is contained in what is returned. Below is some basic client test code you can try to see what is returned from a server.

//zoomkat 11-04-13
//simple client test
//for use with IDE 1.0.1
//with DNS, DHCP, and Host
//open serial monitor and send an e to test client GET
//for use with W5100 based ethernet shields
//remove SD card if inserted
//data from myIP server captured in readString 

#include <SPI.h>
#include <Ethernet.h>
String readString;

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address

char serverName[] = "checkip.dyndns.com"; // myIP server test web page server
EthernetClient client;

//////////////////////

void setup(){

  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    while(true);
  }

  Serial.begin(9600); 
  Serial.println("client readString test 11/04/13"); // so I can keep track of what is loaded
  Serial.println("Send an e in serial monitor to test"); // what to do to test
  Serial.println();
}

void loop(){
  // check for serial input
  if (Serial.available() > 0) //if something in serial buffer
  {
    byte inChar; // sets inChar as a byte
    inChar = Serial.read(); //gets byte from buffer
    if(inChar == 'e') // checks to see byte is an e
    {
      sendGET(); // call sendGET function below when byte is an e
    }
  }  
} 

//////////////////////////

void sendGET() //client function to send/receive GET request data.
{
  if (client.connect(serverName, 80)) {  //starts client connection, checks for connection
    Serial.println("connected");
    client.println("GET / HTTP/1.1"); //download text
    client.println("Host: checkip.dyndns.com");
    client.println("Connection: close");  //close 1.1 persistent connection  
    client.println(); //end of get request
  } 
  else {
    Serial.println("connection failed"); //error message if no client connect
    Serial.println();
  }

  while(client.connected() && !client.available()) delay(1); //waits for data
  while (client.connected() || client.available()) { //connected or data available
    char c = client.read(); //gets byte from ethernet buffer
    readString += c; //places captured byte in readString
  }

  //Serial.println();
  client.stop(); //stop client
  Serial.println("client disconnected.");
  Serial.println("Data from server captured in readString:");
  Serial.println();
  Serial.print(readString); //prints readString to serial monitor 
  Serial.println();  
  Serial.println();
  Serial.println("End of readString");
  Serial.println("==================");
  Serial.println();
  readString=""; //clear readString variable

}

i saw that code on forum and tried, i can get correct result from text file but with http infos etc. My text file only have few letters.

thats what i saw:

HTTP/1.1 200 OK
Date: Fri, 26 Dec 2014 00:42:00 GMT
Server: Apache/2.2.29 (Unix) mod_ssl/2.2.29 OpenSSL/1.0.1e-fips mod_bwlimited/1.4 PHP/5.4.35
Last-Modified: Thu, 25 Dec 2014 23:14:04 GMT
ETag: "3900980-6-50b1290793e12"
Accept-Ranges: bytes
Content-Length: 6
Connection: close
Content-Type: text/plain

abcd

Once you have captured what is returned in a String (like readString), you could use something like below to see if "abcd" is contained in the String.

          if(readString.indexOf("abcd") >0)//checks for abcd
          {
            Serial.println("woohoo, abcd!");
          }
          else
          {
            Serial.println("bummer, no go!");
          }
          //clearing string for next read
          readString="";

thanks for your help! its worked for me..