Guest User

Untitled

a guest
Nov 23rd, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. try {
  2. if(nombre.length() == 0){
  3. JOptionPane.showMessageDialog(null, "ERROR 404");
  4. return false;
  5. }else{
  6. String urlLink = "http://localhost/ejercito/consulta.php?Nombre="+nombre;
  7. URL url = new URL(urlLink);
  8.  
  9.  
  10.  
  11. HttpURLConnection conn = (HttpURLConnection) url.openConnection();
  12. conn.setRequestMethod("GET");
  13.  
  14. BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
  15. StringBuffer sb = new StringBuffer();
  16.  
  17. in.close();
  18. System.out.println(sb.toString());
  19. return true;
  20. }
  21. }catch(Exception x){
  22. JOptionPane.showMessageDialog(null, "ERROR 404");
  23. return false;
  24. }
Add Comment
Please, Sign In to add comment