---
title: "httpServer and support for POST or GET with URL parameters"
url: "https://maker.wiznet.io/forum/15901"
markdown_url: "https://maker.wiznet.io/forum/15901/md"
type: "Forum topic"
category: "Ethernet Chips"
author: "allenhuffman"
created: "2025-10-07T05:32:37+09:00"
last_activity: "2025-10-17T16:33:59+09:00"
language: "en"
views: 8
replies: 1
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# httpServer and support for POST or GET with URL parameters

## Question

Asked by allenhuffman on 2025-10-07 in Ethernet Chips.

I recently started working with the WIZnet I/O library, porting it to a PIC24 processor using the CCS PCD compiler. Due to needing to make so many changes in the library to make PCD happy, I then tried the Microchip MPLAB X compiler. I know very little about it, but I have our board up and running with WIZnet 5500 support, TCP server, SNMP server, and basic HTTP web server.

The httpServer example has support for GET (which it would need for loading web pages) and POST. But, the POST does not pass along the body, which (if I understand it correctly) is where the form data would be.

Likewise, the GET endpoint trims out anything but the URL so you only get "status.cgi" instead of the form's "status.cgi?parameter1=value&parameter2=value".

Is there a way to POST data to this server? It seems being able to set the value of a DAC or such would be a very basic requirement for an embedded server.

I modified one function to pass in the complete URL and then was able to do this using the GET endpoint, but I wondered if there was a "better" way. I'd like to keep the code as close as possible to base so if any updates happen, bringing them in would be easier.

In case anyone else goes down this road...

```plaintext
//uint8_t http_get_cgi_handler(uint8_t * uri_name, uint8_t * buf, uint32_t * file_len);
uint8_t http_get_cgi_handler(uint8_t * uri_name, st_http_request * p_http_request, uint8_t * buf, uint32_t * file_len);
```

Then over in **http_process_handler()** under METHOD_GET:

```plaintext
        if (p_http_request->TYPE == PTYPE_CGI) {
            //content_found = http_get_cgi_handler(uri_name, pHTTP_TX, &file_len);
            content_found = http_get_cgi_handler(uri_name, p_http_request, pHTTP_TX, &file_len);
```

This adds an additional parameter which is a pointer to the "full" URI recieved, containing all the parameters passed in from the GET.

In the handler...

```plaintext
//uint8_t http_get_cgi_handler(uint8_t * uri_name, uint8_t * buf, uint32_t * file_len) {
uint8_t http_get_cgi_handler(uint8_t * uri_name, st_http_request * p_http_request, uint8_t * buf, uint32_t * file_len) {
```

...there is a bit where it parses for stuff, and now it has the full URI buffer to look for the parameters:

```plaintext
uint8_t http_get_cgi_handler(uint8_t * uri_name, st_http_request * p_http_request, uint8_t * buf, uint32_t * file_len) {
    uint8_t ret = HTTP_OK;
    uint16_t len = 0;

    if (predefined_get_cgi_processor(uri_name, buf, &len)) {
        ;
    } else if (strcmp((const char *)uri_name, "status.cgi") == 0) {
        make_json_status (buf, &len);
    }
    // ADDED CODE:
    else if (strcmp((char *)uri_name, "set_power.cgi") == 0) {
        //char *param = strstr((char *)uri_name, "powerLevel=");
        char *param = strstr((char *)p_http_request->URI, "powerLevel=");
        if (param) {
            uint16_t newPowerLevel = atoi(param + strlen("powerLevel="));
            PowerControlSet (newPowerLevel);
            len = sprintf((char *)buf, "{\"result\":\"success\",\"powerSetLevel\":%u}", newPowerLevel);
        } else {
            len = sprintf((char *)buf, "{\"result\":\"error\",\"message\":\"Missing parameter\"}");
        }
    } else {
        // CGI file not found
        ret = HTTP_FAILED;
    }

    if (ret)	{
        *file_len = len;
    }
    return ret;
}
```

This is working, but I know almost nothing about this modern javascript/cgi way of doing web pages. I am stuck in the old dialup internet days of making webpages in HTML by hand, or using Dreamweaver when I was lazy. This is all new to me.

Advice appreciated.

## Replies

### Reply 1 by Hannah, 2025-10-17

The code below is from WIZ750SR Web and WIZ550web. Please refer to these code samples.

<https://github.com/wiznetmaker/WIZ750SR_WebServer>

<https://docs.wiznet.io/Product/Modules/App-Module/WIZ550web#download>

---

Source: https://maker.wiznet.io/forum/15901
