Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.InputStreamReader;
- import java.net.*;
- public class Internet {
- public static void main(final String[] args) throws Exception {
- Proxy proxy = new Proxy(Proxy.Type.HTTP,
- new InetSocketAddress("192.168.0.2", 3128)
- );
- // URL url = new URL("http://school.ioffe.ru/");
- URL url = new URL("https://vk.com/api.php?lang=en&oauth=1&method=users.get&user_ids=7373");
- HttpURLConnection connection = (HttpURLConnection)
- url.openConnection(proxy /* Only from school, otherwise no parameter here */);
- BufferedReader br = new BufferedReader(
- new InputStreamReader(
- connection.getInputStream()/*, "KOI8-R"*/));
- String s;
- while ((s = br.readLine()) != null) {
- System.out.println(s);
- }
- br.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement