# Is it possible to do a HTTP post from a Processing program?

**URL:** <https://discourse.processing.org/t/is-it-possible-to-do-a-http-post-from-a-processing-program/32224>\
**Category:** Libraries\
**Created:** [September 13, 2021, 7:42am UTC](https://discourse.processing.org/t/is-it-possible-to-do-a-http-post-from-a-processing-program/32224 "2021-09-13T07:42:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![TeppoTee](https://avatars.discourse-cdn.com/v4/letter/t/82dd89/32.png) [@TeppoTee](https://discourse.processing.org/u/TeppoTee)\
**Post date:** [September 13, 2021, 7:42am UTC](https://discourse.processing.org/t/is-it-possible-to-do-a-http-post-from-a-processing-program/32224/1 "2021-09-13T07:42:02Z")

</div>

I’ve been a Processing heavy user for years. Among other things have used loadString() quite a lot to fetch information from web server(s) . Is there a counterpart to loadStrings() which would allow me to do a HTTP post to (my own) webserver? I looked in the documentation and saveStrings doesn’t seem to support the use of URL parameters.

Or, should I just start learning P5\*js? I’m afraid the latter is true 🙂

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [September 17, 2021, 7:56pm UTC](https://discourse.processing.org/t/is-it-possible-to-do-a-http-post-from-a-processing-program/32224/2 "2021-09-17T19:56:58Z")

</div>

Hello,

This may be of interest:

> **[Network / Libraries](https://processing.org/reference/libraries/net/index.html)**
>
> Send and receive data over the Internet through simple clients and servers.

`:)`

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [September 17, 2021, 10:17pm UTC](https://discourse.processing.org/t/is-it-possible-to-do-a-http-post-from-a-processing-program/32224/3 "2021-09-17T22:17:36Z")

</div>

For POST specifically note that for Processing 4 / Java11+, posting can be done through java.net.http.HttpClient.

An example (in Java):

> **[How to send HTTP GET POST request in Java with HttpURLConnection and HttpClient](https://zetcode.com/java/getpostrequest/)**
>
> Java HTTP GET/POST tutorial shows how to send
> a GET and a POST request in Java. We use built-in HttpURLConnection class and
> standard Java and Apache HttpClient class.

…and the library documentation:

[https://openjdk.java.net/groups/net/httpclient/intro.html](https://openjdk.java.net/groups/net/httpclient/intro.html)

However, isn’t available in Java 7-8 / Processing 3.x. For that, you can use the HTTP Requests For Processing by Madson and Shiffman – the library is installed through Contributions Manager. Here are related discussions:

> [@Please, help me. API Post method, I want to solve it](https://discourse.processing.org/t/please-help-me-api-post-method-i-want-to-solve-it/29328/3):
>
> The link has been modified so that you can view the material. How to write the end point? How to make a post form? I wonder.

> [@Processing Network HTTP Request Help](https://discourse.processing.org/t/processing-network-http-request-help/17069/2):
>
> Try examples here: slight_smile

> [@HTTP POST Request Issue](https://discourse.processing.org/t/http-post-request-issue/4338):
>
> Hi there, At a basic level, i’ve got a Raspberry Pi with MusicBox loaded. I’m using a second machine to change the audio using HTTP requests. My request is - { “method”: “core.playback.get\_current\_tl\_track”, “jsonrpc”: “2.0”, “id”: 1 } posted with the header “Content-Type”, “application/json”);" If I use another peice of software, for example Postman, to send the string, it works. I’m using the HTTP Request library from Dan Shiftman. The issue, i think, is when I use post.addData it requires…

---

<div class="post-metadata">

**Author:** ![TeppoTee](https://avatars.discourse-cdn.com/v4/letter/t/82dd89/32.png) [@TeppoTee](https://discourse.processing.org/u/TeppoTee)\
**Post date:** [September 19, 2021, 9:55pm UTC](https://discourse.processing.org/t/is-it-possible-to-do-a-http-post-from-a-processing-program/32224/4 "2021-09-19T21:55:50Z")

</div>

Thx a lot! Looks very useful,will try this tomorrow.
