Advertisement
Guest User

Untitled

a guest
Jul 24th, 2014
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1. import java.net.HttpURLConnection;
  2. import java.net.URL;
  3.  
  4. public class LocalHostRefresher {
  5.  
  6.   public static void main( String[] args ) throws Exception {
  7.     get("http://192.168.0.100/restart.php");
  8.     get("http://192.168.0.106/restart.php");
  9.   }
  10.  
  11.   // HTTP GET request
  12.   private static void get( String input ) throws Exception {
  13.     URL url = new URL( input );
  14.     HttpURLConnection connection = (HttpURLConnection) url.openConnection();
  15.    
  16.     connection.setRequestProperty( "User-Agent", "LocalHostRefresher/1.0" );
  17.    
  18.     int responseCode = connection.getResponseCode();
  19.    
  20.     System.out.println( "HTTP GET " + url );
  21.     System.out.println( "  Response Code : " + responseCode );
  22.   }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement