//get 发送短信
public static String send_sms(String mobile_phone, String msg) {
String ret_str = "";
BufferedReader rd=null;
try {
String send_content=URLEncoder.encode(msg.replaceAll("<br/>", " "), "GBK");//发送内容
String myurl=getPropertiesByKey("sms_get")+"?CorpID="+
getPropertiesByKey("sms_userId")+"&Pwd="+getPropertiesByKey("sms_password")
+"&Cell=&SendTime=&Mobile="+mobile_phone+"&Content="+ send_content;
System.out.println("send sms url:"+myurl);
//System.out.println(myurl);
URL url = new URL(myurl);
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
// Get the response
rd = new BufferedReader(new InputStreamReader(conn.
getInputStream()));
String line;
while ( (line = rd.readLine()) != null) {
ret_str += line;
}
rd.close();
}
catch (Exception e) {
System.out.println(e.toString());
ret_str="2";
}
finally{
try {
if(rd!=null)
rd.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
System.out.println("发送短信返回值:"+ret_str);
return ret_str;
}
宝贝网址: