Make HTTP request


#1

Hi,

I have a Wismo228 (GSM/GPRS modem) and want to use it to post data to a website. At the moment I am testing with google. To run a google search, the url of the request is

google.com/search?rls=en&q=keywords

I begin by opening a TCP client socket to www.google.com, at port 80. But then how do I send the http request to server ? Should I send

GET /search?/search?rls=en&q=keywords \n\n

or do I need to build the request in a different way ?

Thanks,

Nelson


#2

please read below:
[url]https://forum.sierrawireless.com/t/how-to-send-a-post-method/4991/1]


#3

Thanks, but it still does not work. It seems that whenever I send data, the modem hangs and does not reply anymore. For instance,
I cannot leave data mode.

Nelson


#4

Ok, I figured out what I was doing wrong. First the GET request was badly formatted, thanks to lotam for pointing me to the post with the proper syntax.

But then I was making another error. After sending the request, I listened to the reply using the same function that sends AT commands. This expects all replies from
the modem to delimited with 0x0D 0x0A, which of course the google reply is not.

As soon as I changed this, I immediately saw the HTTP reply sent by google.