static S ntUpload(S title, S text) { ret ntUpload(programID(), title, text); } static String ntUpload(String gummipw, String title, String text) { ret ntUpload(gummipw, title, text, ""); } static String ntUpload(String gummipw, String title, String text, String comment) ctex { if (gummipw == null || gummipw.length() == 0) throw new RuntimeException("Need gummi password."); System.out.println("Uploading:"); System.out.println(" " + gummipw + " (" + text.length() + " chars)"); System.out.println(" " + title); int displayLength = 40; System.out.println(" " + (text.length() > displayLength ? quote(text.substring(0, displayLength)) + " [...]" : quote(text))); URL url = new URL("http://tinybrain.de:8080/nt-int/add_snippet.php"); String postData = makePostData( "gummipw", gummipw, "text", text, "title", title, "comment", comment); String contents = doPost(postData, url.openConnection(), url); if (isInteger(contents)) { long id = parseSnippetID(contents); System.out.println("=> #" + id); return "#" + id; } else throw new RuntimeException("Server error: " + contents); }