Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main;
- import java.net.URL;
- import java.io.*;
- import javax.net.ssl.HttpsURLConnection;
- public class JavaHttps
- {
- public static void main(String[] args)throws Exception{
- System.setProperty("javax.net.ssl.keyStore", "c:/java/seiho.p12");
- System.setProperty("javax.net.ssl.keyStorePassword", "Seiho1");
- System.setProperty("javax.net.ssl.keyStoreType", "PKCS12");
- URL mi_url = new URL("https://api1.multiinfo.plus.pl/sendsms.aspx?" +
- // ID usługi zgodnie z ustawionym w MultiInfo - UZUPEŁNIĆ
- "serviceId=4582" +
- // Login użytkownika - UZUPEŁNIĆ
- "&login=seiho" +
- //Hasło użytkownika - UZUPEŁNIĆ
- "&password=qwertyuiop" +
- // Numer MSISDN adresata wiadomości SMS - UZUPEŁNIĆ
- "&dest=48729209549" +
- // Treść wiadomości SMS
- "&text=To+jest+testowy+SMS+z+API+https+w+jezyku+Java");
- HttpsURLConnection con = (HttpsURLConnection)mi_url.openConnection();
- InputStream ins = con.getInputStream();
- InputStreamReader isr = new InputStreamReader(ins);
- BufferedReader in = new BufferedReader(isr);
- String inputLine;
- while ((inputLine = in.readLine()) != null)
- {
- System.out.println(inputLine);
- }
- in.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement