Need a hello world Http post BGS2 | Telit Cinterion IoT Developer Community
March 22, 2017 - 6:19pm, 1958 views
I'm trying to do a simple post:
server side script is simple:
<?php
print_r($_POST)
?>
This works well will curl post requests.
Now I want to post "foo=bar" from a BGS2, here is my script
at^sics=0,contype,none
at^sics=0,contype,gprs0
at^sics=0,alphabet,0
at^siss=0,srvtype,http
at^siss=0,conid,0
at^siss=0,alphabet,0
at^siss=0,hcmethod,1
at^siss=0,hccontlen,7
at^siss=0,address, http://placeholder.com/script.php
at^siso=0
at^sisw=0,7
foo=bar // this is where I gather information should be sent
at^sisr=0,100
*response*^SISR: 0,10
Array
(
)
OK
***
Could anyone point out my issue here? I'm sure it is trivial, but I this has two of us stumped...
So we **** our issues. We needed to declare the content type. we included the following command before at^siss=0,hccontlen,7:
at^siss=0,hcProp,"Content-Type: application/x-www-form-urlencoded;charset=utf-8"
I hope this helps someone...
Hello,
Have you tried to use some public HTTP test server?
How about if you use something like "$postdata = file_get_contents("php://input");" and then echo it instead of "print_r($_POST)" in your script?
Can you check the firmware version with ATI1?
Can you also check at^sisi? and at^sise=0 after sending the data? Please also paste the log with replies.
Regards,
Bartłomiej