I am trying to send SMS via java using URL connection, when I'm using the url directly in the browser i receive the SMS, however, using java code seems there is an issue when I call the URL..I wonder if using HttpURLConnection will do the job or not?
code as below :
try{
String myMobile = "Country code"+user.getMobile();
String Url_str = "http://sms.com/Api/.......+ myMobile+;
System.out.println(Url_str);
URL myURL = new URL(Url_str);
URLConnection myURLConnection = myURL.openConnection();
myURLConnection.connect();
}
catch (MalformedURLException e) {
// new URL() failed
}
catch (IOException e) {
// openConnection() failed
}