jms

import java.net.URLEncoder; import java.net.URL; import java.net.URLConnection; import java.util.*; import java.io.*; class http_post { public String send_sms(String user_id, String password, String mobile_phone, String msg, String send_date, String subcode) { String ret_str = ""; try { // Construct data String data = "user_id=" + user_id + "&password=" + password + "&mobile_phone=" + mobile_phone + "&msg=" + URLEncoder.encode(msg, "GBK") + "&send_date=" + send_date + "&subcode=" + subcode; // Send data URL url = new URL("http://bms.hichina.com/sms_gateway/sms_api"); URLConnection conn = url.openConnection(); conn.setDoOutput(true); OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream()); wr.write(data); wr.flush(); // Get the response BufferedReader rd = new BufferedReader(new InputStreamReader(conn. getInputStream())); String line; while ( (line = rd.readLine()) != null) { ret_str += line; } wr.close(); rd.close(); } catch (Exception e) { System.out.println(e.toString()); } return ret_str; } public static void main(String[] args) throws IOException { http_post http= new http_post(); String ret=http.send_sms("4003","xxxxxxx","13900000000","fromjava中国万岁","","4003"); System.out.println(ret); } } 用户名,即企业代码: $user_id 密码:$password 接收短信的手机号(如果是多个手机号,用逗号分开,最多100个):$mobile_phone 要发送的短信内容:$msg 定时发送时间(格式为:年月日时分秒“040524165823”,如果即时发送置为空):$send_date 子特服号(与企业代码相同):$subCode
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值