WIZnet Developer Forum

HTTP post & get examples

Dear Wiznet,

I would like to create a HTTP post & get message to a server. I am using the Wiznet5100 with ioLibrary.
How would I start with this using the HTTP library included. I just want to create a HTTP post to https://requestb.in/ so I can test my http functionality.

Thanks a lot for any help,

Mark

Hi, Mark.

Please refer to the following link for the implementation of the HTTP client.

thanks for your help:

I implemented your library and studied the main.c

Right now I am connecting to a site that can take on HTTP requests : http://httpbin.org/
So I am using the following variables to connect :

uint8_t Domain_name = “httpbin.org”;
uint8_t URI = “/ip”;
uint8_t flag_sent_http_request = DISABLE;
uint8_t back_end_ip[4] = {54, 225, 177, 165};
uint16_t len = 0, i = 0;

It is opening a socket and gives me a message of opening the socket and sending the message:

HTTP CLIENT: source_port = 52214
HTTP CLIENT: SOCKOPEN
HTTP CLIENT: CONNECTED TO - 54.225.177.165 : 80

but the trigger for receiving is never set by the:

httpc_connection_handler();

So the trigger for the below code is never met:

  	if(httpc_isReceived > 0)
  	{
  		len = httpc_recv(g_recv_buf, httpc_isReceived);
  		printf(" >> HTTP Response - Received len: %d\r\n", len);
  		for(i = 0; i < len; i++) printf("%c", g_recv_buf[i]);
  		printf("\r\n");
  	}

This is while on wireshark I can see TCP packets going both way.
192.168.137.176 is my wiznet 5100 ethernetshield on a nRF52840 (nordic semiconductor)
54.225.177.165 is the website I am sending requests to

Can you please help me with the library, I should note I am using the w5100. So in the httpClient.H I changed the board from w7500 to W5100.

Thanks for any help.

Well I am little further with the issue.

It seems the request I am sending out is not correct:

Anyone have an idea what I am doing wrong, or another site that I can send HTTP GET to ?

Thanks

also I need to know this answer. Please help.

Copyright © 2017 WIZnet Co., Ltd. All Rights Reserved.