SHARE
TWEET

Untitled

a guest May 19th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public static String getServerData(String queryString){
  2.         //
  3.         System.out.println("getServerData.queryString=" + queryString);        
  4.         try{
  5.             URL url = new URL(queryString);
  6.             HttpURLConnection conn = (HttpURLConnection) url.openConnection();
  7.             conn.setDoInput(true);
  8.             conn.setDoOutput(true);
  9.             conn.setRequestProperty("User-Agent", "Mozilla/5.0");
  10.             conn.connect();
  11.             BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
  12.             String inputLine = "";
  13.             String res;
  14.             while((res = in.readLine()) != null) {
  15.                 //inputLine += res;
  16.                 inputLine = inputLine + res;
  17.             }
  18.             in.close();
  19.             conn.disconnect();            
  20.             return inputLine;            
  21.         }catch(Exception exc){
  22.             exc.printStackTrace();
  23.         }        
  24.         return null;
  25.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top