Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Parsing Data from HTTP Request (NodeMCU)

Status
Not open for further replies.

imranahmed

Advanced Member level 3
Advanced Member level 3
Joined
Dec 4, 2011
Messages
817
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Location
Karachi,Pakistan
Activity points
6,493
Hi,

Please let me know how to parse data from HTTP 1.1 request string. My Android App sending HTTP request to NodeMCU that sends "http://192.168.4.1/led/on" + 1234
NodeMCU on serial monitor shows POST /led/on1234 HTTP/1.1.

I want to parse or extract 1234 from request string how is it possible?
 

If you are using the Arduino on the NodeMCU side, the suited way to deal with POST messages is by using the method on() on the ESP8266WebServer library. Just add the led/on/ string as argument of this function and assign a function as the 2nd argument which will get the 1234 as the parameter.

See:
 
If you are using the Arduino on the NodeMCU side, the suited way to deal with POST messages is by using the method on() on the ESP8266WebServer library. Just add the led/on/ string as argument of this function and assign a function as the 2nd argument which will get the 1234 as the parameter.

See:
Thank you for good reply,

Please let me know that how many clients(nodemcu) should connect at a time with server(nodemcu).?
--- Updated ---

If you are using the Arduino on the NodeMCU side, the suited way to deal with POST messages is by using the method on() on the ESP8266WebServer library. Just add the led/on/ string as argument of this function and assign a function as the 2nd argument which will get the 1234 as the parameter.

See:
I do with this

Code:
My URL is "http://192.168.4.1/" + "(" + 122 + ")";
 The request is POST /(122) HTTP/1.1

  String request = client.readStringUntil('\r');
  Serial.println("Request " + request);
  Serial.println();
  int location = request.indexOf(')');  //finds location of first ,
  String value = request.substring(7, location);   //captures first data String
  Serial.println("Value-> " + value);
  int intValue = value.toInt(); // I got 122 as a integer
 
Last edited:

how many clients(nodemcu) should connect at a time with server(nodemcu).?
I presume that in theory should be 255 clients, once each one will be connected within the same 192.168.4.x network.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top