Java program to send SMS through NowsmsGateway | Search |
NowSMS Support Forums ⬆ NowSMS Support - MMS & Advanced Issues ⬆ Archive through July 07, 2009 ⬆ |
◄ ► |
Author | Message | |||
Imraj sk New member Username: Imraj Post Number: 1 Registered: 12-2008 |
Hi can any one please send me the java sample code to send sms from pc to mobile through nowsms gateway.. i have found some links in nowsms but they are not working..i have founf the follwoing code but its not working... can anyt one send me the full java sample code and tell me how to implement.... Thanks in advance... here is the code i have with me.. import java.net.*; import java.io.*; import javax.swing.*; import javax.net.ssl.HttpsURLConnection; class Smssending { public static void main(String args[]) { boolean debug=true; String phone="+91988698866"; String message="Hi welcome to new technologies"; String ppgHost="http://localhost:8800/"; try{ phone=URLEncoder.encode(getMobileId(), "UTF-8"); if(debug) System.out.println("phone---->"+phone); message=URLEncoder.encode(getMessage(), "UTF-8"); if(debug) System.out.println("message---->"+message); } catch (UnsupportedEncodingException e) { System.out.println("Encoding not supported"); } String url_str=ppgHost+"?PhoneNumber="+phone+"&Text="+message; if(debug) System.out.println("path name---url_str----->"+url_str); URL url2=new URL(url_str); HttpURLConnection connection = (HttpURLConnection) url2.openConnection(); connection.setDoOutput(false); connection.setDoInput(true); if(debug) System.out.println("connection :"+connection); String res=connection.getResponseMessage(); if(debug) System.out.println("res :"+res); int code = connection.getResponseCode () ; if ( code == HttpURLConnection.HTTP_OK ) { connection.disconnect() ; } } } iam getting the following error.. i know becoz of those two variables iam getting the error but how to decare that method getmobileid() and getMessage(). Smssending.java:18: cannot find symbol symbol : method getMobileId() location: class Smssending phone=URLEncoder.encode(getMobileId(), "UTF-8"); ^ Smssending.java:21: cannot find symbol symbol : method getMessage() location: class Smssending message=URLEncoder.encode(getMessage(), "UTF-8"); ^ 2 errors | |||
Des - NowSMS Support Board Administrator Username: Desosms Post Number: 312 Registered: 08-2008 |
Have you tried the change suggested in the following thread: http://support.nowsms.com/discus/messages/1/24573.html Please post any follow-up messages to that thread. | |||
peter New member Username: Union111 Post Number: 1 Registered: 11-2008 |
[spam deleted by moderator] |