Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. package main;
  2.  
  3. import java.net.URL;
  4. import java.io.*;
  5. import javax.net.ssl.HttpsURLConnection;
  6.  
  7. public class JavaHttps
  8. {
  9. public static void main(String[] args)throws Exception{
  10.  
  11. System.setProperty("javax.net.ssl.keyStore", "c:/java/seiho.p12");
  12. System.setProperty("javax.net.ssl.keyStorePassword", "Seiho1");
  13. System.setProperty("javax.net.ssl.keyStoreType", "PKCS12");
  14.  
  15. URL mi_url = new URL("https://api1.multiinfo.plus.pl/sendsms.aspx?" +
  16. // ID usługi zgodnie z ustawionym w MultiInfo - UZUPEŁNIĆ
  17. "serviceId=4582" +
  18. // Login użytkownika - UZUPEŁNIĆ
  19. "&login=seiho" +
  20. //Hasło użytkownika - UZUPEŁNIĆ
  21. "&password=qwertyuiop" +
  22. // Numer MSISDN adresata wiadomości SMS - UZUPEŁNIĆ
  23. "&dest=48729209549" +
  24. // Treść wiadomości SMS
  25. "&text=To+jest+testowy+SMS+z+API+https+w+jezyku+Java");
  26.  
  27.  
  28.  
  29. HttpsURLConnection con = (HttpsURLConnection)mi_url.openConnection();
  30.  
  31. InputStream ins = con.getInputStream();
  32.  
  33. InputStreamReader isr = new InputStreamReader(ins);
  34. BufferedReader in = new BufferedReader(isr);
  35.  
  36. String inputLine;
  37.  
  38. while ((inputLine = in.readLine()) != null)
  39. {
  40. System.out.println(inputLine);
  41. }
  42. in.close();
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement