Advertisement
Guest User

Untitled

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