HTTP GET Request
Wireless
No replies yet. Be the first to reply.
Join the discussion.
Wireless
No replies yet. Be the first to reply.
Join the discussion.
Share projects and connect with makers.
Joined before the site update? first.
New to WIZnet Makers?
We sent a verification link to your address. Open it to activate your account, then log in.
Accounts from this email provider are reviewed by an administrator after verification. Approval usually takes one business day.
Already have an account?
Enter your email address. If it belongs to an account, we'll send a link to set a new password. Members who joined before the site update use this to set their password.
If an account uses that address, we sent a link to set a new password. The link works once and expires in 30 minutes.
Know your password?
Need an account?
RE: HTTP GET Request
by wizdaniel ·
Hi GMK.
you should use the +SSEND command like below.
AT+SSEND=0,18{0x0d}
I hope this documents in below links will be helpful to you.
→ SSEND Command description
https://wizwiki.net/wiki/doku.php?id=products:wizfi250:wizfi250pg:start#method_of_setting_tcp_client_and_exchanging_data_in_command_mode
→ HTTPS Requset
https://wizwiki.net/wiki/doku.php?id=products:wizfi250:wizfi250pg:start#example_of_ssl_connection
RE: HTTP GET Request
by GMK ·
Hi wizdaniel,
Thank you for the correction on my SSEND command, I think it has helped.
The next question is how are headers supposed to be formatted for this?
The example provided shows no header, other than the GET call, and I get an error 400 if I try like this. I also get error 400 the way I am formatting the command right now, so I would appreciate any help you could give me on this as well.
Edit: Thought I should add that I would like to know if there’s a place where I should insert the full url, as I am trying to access a specific page of an IIS server at this ip address. I have tried inserting the full header to access this site into this line but with no luck.
GET / HTTP/1.1 {0x0d}{0x0a}
{0x0d}{0x0a}
[OK]
x0d}{0x0a}
[ERROR: INVALID INPUT]
{0x0d}{0x0a}
[ERROR: INVALID INPUT]
{0,192.168.1.13,80,490}HTTP/1.1 400 Bad Request
Content-Type: text/html; charset=us-ascii
Server: Microsoft-HTTPAPI/2.0
Date: Mon, 22 Jul 2019 19:58:15 GMT
Connection: close
Content-Length: 311
Bad RequestBad Request
HTTP Error 400. The request is badly formed.
[DISCONNECT 0]
RE: RE: HTTP GET Request
by wizdaniel ·
Hi
here is the HTTP request message sample to request hello.html page from the webserver running on abc.com
if you want to send formed data to the server, you have to use a ‘POST’ method instead of the ‘GET’ like below.
Content-Type and Length are important parameters in the POST method.
Regards
RE: HTTP GET Request
by GMK ·
Hi
Unfortunately, this formatting has not worked for me, I still receive bad request errors. As such I have several questions, and I should add that I’m using TeraTerm to connect to the device.
Where you put in “{0x0d}{0x0a}” does that have to be “{0x0d{0x0a}” or is it just to supposed to be carriage return line feed?
In the documentation for opening an SSL connection, it says to open the Socket in Command Mode, (0) not data mode (1), but when I put it in Command Mode, with 0 as the last input to the SCON command, I only receive an “INVALID INPUT” error, as opposed to when I put a 1 in, I receive:
HTTP/1.1 400 Bad Request
Content-Type: text/html
Date: Mon, 29 Jul 2019 20:26:11 GMT
Server: nginx
Content-Length: 166
Connection: keep-alive
400 Bad Request400 Bad Request
nginx which leads me to think a 1 is needed here. I am attaching the commands being sent (apart from the association to the access point) in the hopes that you can advise me further: sendln 'AT+SCON=SO,TCN,52.22.188.80,80,5000,0' pause 3 sendln 'AT+SSEND=0,,,18' sendln 'GET /get HTTP/1.1'#13#10'Host: httpbin.org'#13#10''#13#10'' Note this is being sent via TeraTerm Macro, so the sendln and pause is just for TeraTerm, and the #13#10 is to indicate carriage return line feed to TeraTerm.
Any help you could provide would be greatly appreciated.
Regards
RE: HTTP GET Request
by wizdaniel ·
Hi
there is a example request to get some message from the httpbin.org as you tried.
I guess that the message you sent was right formed message.
but message length was wrong. you should set the message length in the AT+SSEND the 18 to right length.
I prefer to set the length ‘44’ for above example.
the {0x0d}{0x0a} means the carrige return&line feed.
be careful when you put the CR&LF using the options in the TeraTerm.
because AT+SSEND cmd only needs “CR”. and HTTP messages need “CR&LF”.