Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String params = "{\"prefixText\":\"aCity\",\"count\":10,\"contextKey\":\"he\"}";
- conn = (HttpURLConnection) new URL("http://bus.gov.il/WebForms/wfrmMain.aspx/GetCompletionList").openConnection();
- conn.setDoOutput(true);
- conn.setRequestMethod("POST");
- conn.setFixedLengthStreamingMode(params.length());
- conn.addRequestProperty("Content-Type", "application/json; charset=UTF-8");
- conn.addRequestProperty("Referer", "http://bus.gov.il/WebForms/wfrmMain.aspx?width=1024&company=1&language=he&state=");
- Writer out = new BufferedWriter(new OutputStreamWriter(conn.getOutputStream()));
- out.write(params);
- out.close();
- String answer = readStream(conn.getInputStream(), "utf-8");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement