https://github.com/runemadsen/http-requests-for-processing
https://github.com/runemadsen/http-requests-for-processing
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/runemadsen/http-requests-for-processing
- Owner: runemadsen
- License: mit
- Created: 2012-03-09T21:46:02.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2022-05-30T09:48:41.000Z (about 3 years ago)
- Last Synced: 2025-03-28T22:49:02.428Z (2 months ago)
- Language: Java
- Homepage: http://www.runemadsen.com
- Size: 2.1 MB
- Stars: 141
- Watchers: 7
- Forks: 39
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Introduction
------------HTTP Requests for Processing is a small library that takes the pain out of doing HTTP requests in Processing.
HTTP Requests for Processing is based on code by [Chris Allick](http://chrisallick.com/) and [Daniel Shiffman](http://www.shiffman.net/).
How to
------------
Install the library by [downloading the latest release](https://github.com/runemadsen/HTTProcessing/releases) or via the [Processing contribution manager](http://wiki.processing.org/w/How_to_Install_a_Contributed_Library).Then import the library in your sketch:
```Java
import http.requests.*;
```
Then you can make GET and POST requests from your code:
```Java
GetRequest get = new GetRequest("http://httprocessing.heroku.com");
get.send();
println("Reponse Content: " + get.getContent());
println("Reponse Content-Length Header: " + get.getHeader("Content-Length"));
PostRequest post = new PostRequest("http://httprocessing.heroku.com");
post.addData("name", "Rune");
post.send();
println("Reponse Content: " + post.getContent());
println("Reponse Content-Length Header: " + post.getHeader("Content-Length"));
```
To authenticate requests using a Basic Access authentication scheme, include the following in your requests:
```Java
get.addUser("username", "password");
post.addUser("username", "password");
```
To add a header to your request, including the following:
```Java
//method: addHeader(name,value)
get.addHeader("Accept", "application/json");
post.addHeader("Content-Type", "application/json");
```