Hi,
I use LWIP and FreeRTOS like WEB server. It's OK. But now, I want send data to otger page for example by GET. Like this: http://www.page.com/p.php?json=1234
Can you help me please?
Here is my code:
portCHAR PAGE_BODY[512];
struct netconn *conn1 = NULL;
struct ip_addr local_ip;
struct ip_addr remote_ip;
int rc1, rc2;
strcat((char *) PAGE_BODY, "HTTP/1.0 ");
strcat((char *) PAGE_BODY, "Method: POST\r\n");
strcat((char *) PAGE_BODY, "Server: Ethernet termostat\r\n");
strcat((char *) PAGE_BODY, "Content-Length: 9\r\n");
strcat((char *) PAGE_BODY, "json=1234\r\n\r\n");
strcat((char *) PAGE_BODY, "Content-type: application/x-www-form-urlencoded\n\n");
/* Create a new TCP connection handle */
conn1 = netconn_new(NETCONN_TCP);
if (conn1!= NULL)
{
local_ip.addr = NULL;
rc1 = netconn_bind ( conn1, &local_ip, 0 );
IP4_ADDR(&remote_ip, 46, 28, 105, 62);
//remote_ip.addr = remote_ip; // static or by netconn_gethostbyname ()
rc2 = netconn_connect ( conn1, &remote_ip, 80 );
if ( rc1 != ERR_OK || rc2 != ERR_OK )
{
netconn_write(conn1, PAGE_BODY, strlen(PAGE_BODY), NETCONN_COPY);
netconn_delete ( conn1 );
}
}
else
{
printf("can not create netconn");
}