Advertisement
Guest User

Untitled

a guest
May 23rd, 2015
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. public static void HtmlCookie() throws Exception
  2. {
  3. URL url = new URL("http://intranet2.kbtu.kz/home.aspx");
  4.  
  5. HttpURLConnection connection = null;
  6. connection = (HttpURLConnection) url.openConnection();
  7. connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6");
  8. connection.setRequestProperty("Cookie", "uname=AQAAANCMnd8BFdERjHoAwE%2fCl%2bsBAAAAdEBpNRprKkuhk%2fnIwaLLPgQAAAACAAAAAAADZgAAqAAAABAAAADZqjhvec%2bV30HPxZ7khpUvAAAAAASAAACgAAAAEAAAAEQ9EI8%2bQHNdK8RjqtcJRrYgAAAAIbTnx5Q0HjHreoZn8Q5TIVluiwUapbiqYZY%2fdYYzC84UAAAApN%2bIOFgfcLv7r%2fLO3wV4hPG%2f%2bOM%3d;");
  9. connection.connect();
  10. String inputLine;
  11. BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF8"));
  12. while ((inputLine = in.readLine()) != null)
  13. System.out.println(inputLine);
  14. in.close();
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement