A
A
Alexey Poloz2016-02-09 16:32:26
Arduino
Alexey Poloz, 2016-02-09 16:32:26

Arduino How to extract the main part from the resulting web page?

I get the page:
+IPD, 155:HTTP/1.1 200 OK
Date: ...
Server: Apache/2.4.10 (Raspbian)
Content-Length: 6
Content-Type: text ...
123
123, without all the unnecessary information about the page?
Here is the code:

#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11);
#include <String.h>
int ko=1;
bool f=false;

void viv()
{
delay(50);
while (mySerial.available())
  {
  char y;
  y=mySerial.read();
  Serial.write(y);
  delay(10);
  }
}

void pr()
{
mySerial.println("AT+RST");
viv();
mySerial.println("AT+CWMODE_DEF=1");
viv();
mySerial.println("AT+CWJAP_DEF=\"routerr\",\"1029384756\"");
delay(6000);
viv();
mySerial.println("AT+CIPSTART=\"TCP\",\"192.168.1.11\",80");
viv();
mySerial.println("AT+CIPSEND=43");
delay(50);
viv();
mySerial.println("GET / HTTP/1.1\r\nHost: 192.168.1.11\r\n\r\n\r\n\r\n");
delay(5000);
viv();
}

void setup()
{
Serial.begin(9600);
mySerial.begin(9600);
pr();
}

void loop()
{
delay(10);
if (millis()>ko*10000 || f==true)
{
ko++;
pr();
}
else
{delay(10000); f=true;}
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question