Skip to content

Instantly share code, notes, and snippets.

@l1x
Created May 7, 2011 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save l1x/960605 to your computer and use it in GitHub Desktop.
Save l1x/960605 to your computer and use it in GitHub Desktop.
post
try {
//data=json...
URL url = new URL("http://couch.nohup.hu/nohup_urls");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(data);
wr.flush();
// Get the response
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
while ((line = rd.readLine()) != null) {
// Process line...
}
wr.close();
rd.close();
} catch (Exception e) {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment