raspberrypi / pico-sdk

BSD 3-Clause "New" or "Revised" License
3.67k stars 913 forks source link

Support for HTTP GET and POST in Raspberry Pi Pico W SDK #1588

Closed Chrisx43 closed 9 months ago

Chrisx43 commented 9 months ago

I would like to ask about the current and future support for HTTP GET and POST methods in the Raspberry Pi Pico W SDK

Is there currently the capability or a plan to integrate HTTP GET and POST functionalities into the Raspberry Pi Pico W SDK? These features would be immensely beneficial for projects involving web communication, data retrieval, and integration with online services.

If support for HTTP communication is currently not available, I kindly ask of adding this feature in future releases of the SDK. It would significantly expand the potential use cases and applications for the Raspberry Pi Pico W.

Additional Information:

Thank you.

aallan commented 9 months ago

Have you looked at the raspberrypi/pico-examples repo? There are networking examples there, e.g. see https://github.com/raspberrypi/pico-examples/tree/master/pico_w/wifi/tls_client for how to make a HTTPS GET request.

peterharperuk commented 9 months ago

There's a http API here - which I hope to get included in the next release

https://github.com/raspberrypi/pico-sdk/pull/1388 https://github.com/raspberrypi/pico-examples/pull/385

Feedback welcome.

Chrisx43 commented 9 months ago

Hey, thanks for the help! I cloned the branch with the http_client example. However, I'm hitting a wall trying to build the http_client, it builds sucessfully but no files in the build folder. Strangely, I can build the other examples in the wifi folder just fine.

Quick question: Is there also a POST function available? I can't check it myself at the moment because there's no definition for the header files in http_client.c, which I suspect is causing the build failure.

Any tips on fixing the build issue and info on the POST function would be awesome

peterharperuk commented 9 months ago

Sorry, I just checked and it builds fine for me. Suggest you start from a clean folder. It doesn't support POST, we're just using the http client that comes from lwip.

chseAtHms commented 9 months ago

"Is there any possibility that the Pico will soon support POST too?"

lurch commented 9 months ago

I did a quick bit of searching and just found https://github.com/lwip-tcpip/lwip/pull/14 (although I've not tested it mysefl)

aallan commented 9 months ago

@chseAtHms wrote:

"Is there any possibility that the Pico will soon support POST too?"

That's a question you should be asking the LWiP developers. The pico-sdk just pulls the lwip library in from their repo directly as a submodule. If they don't support it, we don't support it.

@lurch wrote:

I did a quick bit of searching and just found lwip-tcpip/lwip#14 (although I've not tested it mysefl)

Oh that's rather nice. Unfortunately there is no chance that's going to get merged into the upstream sitting there. Their repo on Github is just a mirror of the project's actual repo at http://git.savannah.gnu.org/cgit/lwip.git.