| | |
| | | * @return |
| | | */ |
| | | public boolean sendCellulantMessage(String toPhone, String msg){ |
| | | String url = "https://sms.nalosolutions.com/smsbackend/Nal_resl/send-message/"; |
| | | String url = "https://sms.nalosolutions.com/smsbackend/clientapi/Cell_resl/send-message/"; |
| | | HttpRequest post = HttpUtil.createPost(url); |
| | | post.contentType(ContentType.JSON.toString()); |
| | | JSONObject params = new JSONObject(); |
| | |
| | | params.put("msisdn", toPhone); |
| | | params.put("message", msg); |
| | | params.put("sender_id", "I-GO"); |
| | | System.err.println(params.toJSONString()); |
| | | post.body(params.toJSONString()); |
| | | HttpResponse execute = post.execute(); |
| | | String body = execute.body(); |
| | | execute.close(); |
| | | JSONObject jsonObject = JSON.parseObject(body); |
| | | System.err.println(body); |
| | | Integer status = jsonObject.getInteger("status"); |
| | | if(null != status && 1701 == status){ |
| | | return true; |
| | |
| | | |
| | | public static void main(String[] ages){ |
| | | SMSUtil smsUtil = new SMSUtil(); |
| | | smsUtil.sendCellulantMessage("233244915521", "您的验证码为:123456,该验证码5分钟内有效,请勿泄漏于他人!"); |
| | | smsUtil.sendCellulantMessage("233244915521", "Votre code de validation est 123456 et il est valide pendant 5 minutes. Veuillez ne pas le révéler à d’autres personnes."); |
| | | } |
| | | } |