rjwpope
December 23, 2014, 5:56pm
1
I’m trying to use the HTTP POST feature on the HiLoV2 but no matter what I do, any attempt to use AT+KHTTPPOST never returns any data (+KHTTP_ERROR 0,10). Can anyone provide hints or a working sample for sending POST data to a server (I’m using KHTTPPOST as I will eventually want to transition to HTTPS and I’m hoping that once I’ve got HTTPPOST working, HTTPSPOST will be a simple case of adding certificates and S’s).
Here is the full log of what I’m sending: (> is to Hilo, < is from Hilo)
AT+KCNXCFG=0,“GPRS”,“everywhere”,“eesecure”,“secure”
< AT+KCNXCFG=0,“GPRS”,“everywhere”,“eesecure”,“secure”
AT+KCNXTIMER=0,60,2,70
< AT+KCNXTIMER=0,60,2,70
AT+KCNXPROFILE=0
< AT+KCNXPROFILE=0
AT+CGATT
< AT+CGATT
AT+KHTTPCFG=0,“httpbin.org ”,80,1
< AT+KHTTPCFG=0,“httpbin.org ”,80,1
AT+KHTTPHEADER=0
< AT+KHTTPHEADER=0
< CONNECT
Accept: text/html–EOF–Pattern–
< OK
AT+KHTTPGET=0,“/get?Data=Msg”
< AT+KHTTPGET=0,“/get?Data=Msg”
< CONNECT
< Here i get the webpage data as expected
AT+KHTTPHEADER=0
< AT+KHTTPHEADER=0
< CONNECT
Content-Type: application/x-www-form-urlencodedContent-Length: 8–EOF–Pattern–
< OK
AT+KHTTPPOST=0,“/post”
< AT+KHTTPPOST=0,“/post”
< CONNECT
Data=msg–EOF–Pattern–
< +KHTTP_ERROR : 0, 10
I have now managed to get this working. It seems my mistake was adding the EOF pattern after the post data content. For any future readers, here is the sequence I am now using:
[color=blue]AT+KCNXCFG=0,“GPRS”,“everywhere”,“eesecure”,“secure”
< [color=red]AT+KCNXCFG=0,“GPRS”,“everywhere”,“eesecure”,“secure”
[color=blue]AT+KCNXTIMER=0,60,2,70
< [color=red]AT+KCNXTIMER=0,60,2,70
[color=blue]AT+KCNXPROFILE=0
< [color=red]AT+KCNXPROFILE=0
[color=blue]AT+CGATT
< [color=red]AT+CGATT
[color=blue]AT+KHTTPCFG=0,“httpbin.org ”,80,1
< [color=red]AT+KHTTPCFG=0,“httpbin.org ”,80,1
[color=blue]AT+KHTTPHEADER=0
< [color=red]AT+KHTTPHEADER=0
< [color=red]CONNECT
[color=blue]Accept: text/html–EOF–Pattern–
< [color=red]OK
[color=blue]AT+KHTTPGET=0,“/get?Data=Msg”
< [color=red]AT+KHTTPGET=0,“/get?Data=Msg”
< [color=red]CONNECT
< Here i get the webpage data as expected
[color=blue]AT+KHTTPHEADER=0
< [color=red]AT+KHTTPHEADER=0
< [color=red]CONNECT
[color=blue]“Content-Length: 16Content-Type: application/x-www-form-urlencodedAccept: / -EOF–Pattern–”
< [color=red]OK
[color=blue]AT+KHTTPPOST=0,“/post”
< [color=red]AT+KHTTPPOST=0,“/post”
< [color=red]CONNECT
[color=blue]Data=msg&A=abcde
< Here i get the webpage data as expected
Hi,
I am trying your sequence of commands in hl6528-g devkit.
I don’t know hilov2 but it seems to have the same commands with hl series.
I am using tera term to communicate with the devkit.
Question… how can I enter the headers?
How can I enter ?
Thanks.