import processing.net.*; class HTTPGet { String response; boolean done; Client client; void start(PApplet applet, String host, String path, int port) { reset(); // Open a TCP socket to the host: client = new Client(applet, host, port); // Print the IP address of the host: //println(client.ip()); // Send the HTTP GET request: client.write("GET " + path + " HTTP/1.1\n"); client.write("HOST: " + host + "\n\n"); } void recieve() { if (client.available() > 0) { response += client.read(); } else { done = true; } } boolean isDone() { return done; } String getResponse() { return response; } void reset() { response = ""; done = false; } }