search text in HTTP Response

Hi there! I am using Ethernet Arduino and I am trying to get some number values of a webpage HTTP Response. The only thing that I get from the response is "Temp1=25" So I have an inData char array which contains this text. I need to find a way to search for the text "Temp1=" and if there is in the inData array, then to point me the pointer value of "T".

I am trying pch = strstr (inData,"Temp1="); with no luck

Whe I check if pch is 0 or not I see that its value is not zero. But I dont know how to find out the value number. When I print pch to serial I get nothing.

pch will be the index to the test string if pch is not NULL. In your case

if(pch != NULL) Serial.println(&inData[pch]);

SurferTim: pch will be the index to the test string if pch is not NULL. In your case

if(pch != NULL) Serial.println(&inData[pch]);

Invalid types char[250] [char*] for array subscript

My HTTP Response will eventually more than 1 temps, and all I need to do, is to search a word in a char array and find out the pointer value of “T” if I am searching for “Temp”

My code: (keep in mind its has some testing variables that are not in use and that it uses a 7 segment too)

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

#include <SoftwareSerial.h>

// These are the Arduino pins required to create a software seiral
//  instance. We'll actually only use the TX pin.
const int softwareTx = 8;
const int softwareRx = 7;

SoftwareSerial s7s(softwareRx, softwareTx);

unsigned int counter = 0;  // This variable will count up to 65k
char tempString[10];  // Will be used with sprintf to create strings

char * pch;

// this must be unique
byte mac[] = {  
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

// change to your network settings
IPAddress ip(192,168,10,194);
IPAddress gateway(192, 168, 10, 150);
IPAddress subnet(255, 255, 255, 0);

// change to your server
IPAddress server(134,124,157,124); // physical server

//Change to your domain name for virtual servers
char serverName[] = "";
// If no domain name, use the ip address above
// char serverName[] = "";

// change to your server's port
int serverPort = 80;

EthernetClient client;
int totalCount = 0;
char pageAdd[64];

char *smsAT;
char inData[250]; // Allocate some space for the string
char inChar; // Where to store the character read
int index = 0; // Index into array; where to store the character

// set this to the number of milliseconds delay
// this is 30 seconds
#define delayMillis 3000

unsigned long thisMillis = 0;
unsigned long lastMillis = 0;

void setup() {
  // Must begin s7s software serial at the correct baud rate.
  //  The default of the s7s is 9600.

  // Clear the display, and then turn on all segments and decimals
  clearDisplay();  // Clears display, resets cursor
  s7s.print("HI  ");  // Displays -HI- on all digits
  s7s.print(" 200");
   clearDisplay();  // Clears display, resets cursor
  setDecimals(0b111111);  // Turn on all decimals, colon, apos

  // Flash brightness values at the beginning
  setBrightness(0);  // Lowest brightness
  setBrightness(127);  // Medium brightness
  setBrightness(255);  // High brightness

  // Clear the display before jumping into loop

  // disable SD SPI

  // Start ethernet
  Serial.println(F("Starting ethernet..."));
  Ethernet.begin(mac, ip, gateway, gateway, subnet);

  // If using dhcp, comment out the line above 
  // and uncomment the next 2 lines

  // if(!Ethernet.begin(mac)) Serial.println(F("failed"));
  // else Serial.println(F("ok"));



void loop()
  thisMillis = millis();

  if(thisMillis - lastMillis > delayMillis)
    lastMillis = thisMillis;

    // Modify next line to load different page
    // or pass values to server

    // sprintf(pageAdd,"/arduino.php?test=%u",totalCount);

    if(!getPage(server,serverPort,pageAdd)) Serial.print(F("Fail "));
    else Serial.print(F("Pass "));

byte getPage(IPAddress ipBuf,int thisPort, char *page)
  char inChar;
  char outBuf[128];



    sprintf(outBuf,"GET %s HTTP/1.1",page);
    sprintf(outBuf,"Host: %s",serverName);
    client.println(F("Connection: close\r\n"));
    return 0;

  // connectLoop controls the hardware fail timeout
  int connectLoop = 0;

      inChar =;
      inData[index] = inChar; // Store it
      index++; // Increment where to write nex*-t
      // set connectLoop to zero if a packet arrives

      inData[index] = '\0'; // Null terminate the string

      smsAT=strstr (inData,"plain");

      connectLoop = 0;


    // if more than 10000 milliseconds since the last packet
    if(connectLoop > 10000)
      // then close the connection from this end.
    // this is a delay for the connectLoop timing


  // close client end
  Serial.print("smsAT: ");
  char Temp1[6];
  Serial.print("Temp1: ");
  int digits = atoi (Temp1);
   Serial.print("digits: ");
//  ********* PROBLEM HERE!!!!!
pch = strstr (inData,"Temp1=");
   // Magical sprintf creates a string for us to send to the s7s.
  //  The %4d option creates a 4-digit integer.
  sprintf(tempString, "%4d", digits);

  // This will output the tempString to the S7S
  setDecimals(0b00010000);  // Sets digit 3 decimal on

  counter++;  // Increment the counter
  delay(100);  // This will make the display update at 10Hz.
  memset(inData, 0, sizeof(inData));  
  memset(Temp1, 0, sizeof(Temp1));  


  return 1;

// Functions NaThAN
// Send the clear display command (0x76)
//  This will clear the display and reset the cursor
void clearDisplay()
  s7s.write(0x76);  // Clear display command

// Set the displays brightness. Should receive byte with the value
//  to set the brightness to
//  dimmest------------->brightest
//     0--------127--------255
void setBrightness(byte value)
  s7s.write(0x7A);  // Set brightness command byte
  s7s.write(value);  // brightness data byte

// Turn on any, none, or all of the decimals.
//  The six lowest bits in the decimals parameter sets a decimal 
//  (or colon, or apostrophe) on or off. A 1 indicates on, 0 off.
//  [MSB] (X)(X)(Apos)(Colon)(Digit 4)(Digit 3)(Digit2)(Digit1)
void setDecimals(byte decimals)

Look at
pch = strstr (inData,“Temp1=”);

All I need to do is to find out the pointer value that directs to the number just after “=”. Please help me on how to find out the pointer value.

My bad. pch is a pointer, not an index. This should print the string starting at the 6th character after the 'T' in "Temp1="

if(pch != NULL) Serial.println(pch+6);