cancel
Showing results for 
Search instead for 
Did you mean: 

SPWF04S Receiving POST data

tabekb
Associate III
Posted on May 17, 2017 at 14:28

I am trying to send data from the browser to the module using POST request with output_demo.html.

The POST request is limited to 64 bytes, so I cannot send more than 64 bytes with a POST...If I send 65 bytes, the last byte is truncated and only 64 bytes are delivered by the module. Is this a limitation of the module? Can be the number of bytes increased? 64 bytes for a POST are not enough...

I send this from browser : Output=SetNetSet{6;1;0;2;1;0;172.10.20.1;123456789012345;123456789012345678}

There are 68 bytes of data in the above request.

The module outputs this on uart console: +WIND:57:Output from remote:64:SetNetSet{6;1;0;2;1;0;172.10.20.1;123456789012345;123456789012345

The module outputs only 64 bytes, but the request contains 68 bytes...

Thanks

15 REPLIES 15
Posted on May 17, 2017 at 14:45

Ciao Tibor,

we call it 'output' demo. It's used to send to external module's host a short message.

Also on SPWF01S there is a limit, but related to HTTP request (GET, in there).

Different from SPWF01S is the solution: if you want to send the content of a file, simply POST that file!

Test the new webserver POST capability with CURL: 

curl –i –X POST –H “Content-Type: multipart/form-data� –F “

mailto:data=@Desktop/udp_client.c

yourfile.json� 192.168.1.2

You will receive a WIND, containing the file name. That file will be created into RAM disk.

Hope can help

jerry

tabekb
Associate III
Posted on May 17, 2017 at 15:54

Thanks for the answer, but I'm afraid this is not a solution for us. I do not want to send files. I just want to send data from a simple form in my webpage. So, I want to fill my form with 65 characters and then by pressing a button I want to send this data using a POST request. Is this possible or not? I think it should be...

Thanks

Tibor

Posted on May 17, 2017 at 20:15

From HTML point of view, the only difference is related to external host: in case output_demo needs only to parse the +WIND message, in case file it needs both to parse +WIND message and run AT+S.FSR command. So, from final product point of view is the same.

From limit point of view, a limit needs to be there. You can request X, then another customer can request X+1, and so on. A never ending story.

From 64 point of view, I need to check into source code. Tomorrow. I suspect is not a module's limit, but an HTML limit. If you are using embedded output_demo HTML page, probably the limit is into size of the text field that is sent. Do you get the same behaviour also using CURL? Avoid to use embedded output_demo HTML page.

Posted on May 18, 2017 at 09:13

The limitation is in the firmware, not in HTML.

If I send:

curl -i -X POST -H 'Content-type: application/x-www-form-urlencoded' -d 'Output=qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyui123456' 172.10.20.1

the module give me:

+WIND:57:Output from remote:64:qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyui1234

So, I transfer 66 bytes, but the module gives me 64 bytes.

I agree with you that must be a limit. 64 bytes probably are enough for demo purposes, but in a real application we need a little bit more.

Using POST with files, is not a solution in our case, because I need to send data typed in HTML forms, not files.

Thank you

Posted on May 18, 2017 at 09:40

About 64, I'll take care of your request. I'll raise the request to change from 64 to 128.

About POST files, you can implement something into HTML to collect data from form, create a file, and send the file in the end.

Posted on May 18, 2017 at 15:13

Thank you Gerardo, I will set the thread as 'A

ssumed Answered'.

I wanted to avoid using js to create files and use the simple way with POST data, now I have 2 solutions.

Thanks again.

tabekb
Associate III
Posted on May 30, 2017 at 14:35

While working with the module, I've found something strange. I am using the module in Mini AP mode. I am using a script to send POST messages with curl once per second:

curl -i -X POST -H 'Content-type: multipart/form-data' -F 'data=@FileSetGenSet' 172.10.20.1/R.html

R.html is a simple html file in my filesystem, it contains the string 'POST OK'.

In the same time, I have another html file, which sends GET requests every seconds from the browser to a fhtml file. The respond is GET OK. I have 2 problems here:

1. Sometimes, the respond for POST is GET OK and the respond for GET is POST OK. It seems that the module respond to my POST with the response for GET and vice-versa.

2. In MiniAP mode, the client PC goes in Limited acces after max. 1 hour...but sometimes in 5 minutes...and I can't reconnect to my MiniAP server. The module is responding to the AT commands, but I have to restart the module to connect again from my PC.

It seems to be very unstable in MiniAP mode, after 1 hour I need to reset the module, because the client PC is no more connected and I can't reconnect...

Thanks

Posted on August 10, 2017 at 22:03

Gerardo,

Is there a way to send a POST from my webserver to update the JSON file on the backend ? I can see my webpage generated from that JSON, but I need to update it also when the user interracts with the page. So far, I have no idea how to send the JSON back and also update the JSON file. I would like to send the JSON as a string but save it back to the webserver and update the original file. I have tried some permutations with cURL for windows, but the console does not show any activity and cURL acknowledges that the webserver does not reply!

Posted on October 29, 2017 at 13:51

You can send files into SPWF04 thanks to integrated HTTP POST webserver capability. Using a PC, something like this: 

curl –i –X POST –H “Content-Type: multipart/form-data�? –F “

mailto:data=@Desktop/udp_client.c

�? 192.168.1.150

Check AN4965