Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2015
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. import java.io.BufferedReader;
  2. import java.io.DataOutputStream;
  3. import java.io.InputStreamReader;
  4. import java.net.HttpURLConnection;
  5. import java.net.URL;
  6.  
  7. import javax.net.ssl.HttpsURLConnection;
  8.  
  9. try {
  10. String webarg = "http://192.168.2.5/WebQueuePro/index.php/tickets/addticket/";
  11.  
  12. webarg = webarg + "?headless=1&queue=TRACK";
  13.  
  14. for(int i= 0; i < ticket.getLinesCount(); i++){
  15.  
  16. line = ticket.getLine(i);
  17.  
  18. if (line.isProductKitchen()){
  19. webarg = webarg + "&contents[]=" + line.printMultiply() + " +X+ " + URLEncoder.encode(line.printName());
  20. }
  21.  
  22. }
  23.  
  24.  
  25. URL obj = new URL(webarg);
  26. HttpURLConnection con = (HttpURLConnection) obj.openConnection();
  27.  
  28. // optional default is GET
  29. con.setRequestMethod("GET");
  30.  
  31. //add request header
  32. con.setRequestProperty("User-Agent", USER_AGENT);
  33.  
  34. int responseCode = con.getResponseCode();
  35.  
  36. BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
  37. String inputLine;
  38. StringBuffer response = new StringBuffer();
  39.  
  40. while ((inputLine = in.readLine()) != null) {
  41. response.append(inputLine);
  42. }
  43. in.close();
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement