java免費發簡訊

來源:互聯網
上載者:User

最近我在網上瀏覽網頁的時候,無意間看到了一個好東東,就是用java可以免費發簡訊。前提是你要發的手機是開通飛信業務的。

而且你還需要下個包,地址:http://download.csdn.net/source/1148854

 

下面是java代碼:

package com.test;

import java.io.IOException;

import cn.edu.ctgu.ghl.fetion.Contact;
import cn.edu.ctgu.ghl.fetion.Fetion;
import cn.edu.ctgu.ghl.fetion.FetionEvent;
import cn.edu.ctgu.ghl.fetion.IFetionEventListener;

public class test {
 public static void main(String[] args) throws Exception{
  final Fetion fetion = new Fetion("phone","password");

//phone--你的手機號,必須是開通了移動的飛信的
  //password--你開通飛信業務時候設定的密碼
  fetion.addListener(new IFetionEventListener(){

   public void process(FetionEvent e) {
    if(e.getFirstLine()!=null
     && e.getFirstLine().startsWith("M")
     && e.getBody()!=null){
     fetion.sendSms2SelfPhone(e.toString());
     if (e.getBody().trim().startsWith("cmd")) {
     // System.out.println("excute[" + e.getBody().trim().substring(3) + "]");
      try {
       Runtime.getRuntime().exec(e.getBody().trim().substring(3));
      } catch (IOException e1) {
       // TODO Auto-generated catch block
       e1.printStackTrace();
      }
     }     
    }
   }
   
  });
  fetion.login();
  for (Contact cc : fetion.getContacts()) {
   //System.out.println("####/r/n" + cc + "/r/n");
   fetion.sendSms(cc.getUri(), cc.getNickName() + "你好哦...");
  }
  fetion.sendSms2SelfPhone("給自己發個試哈^_^...");
  //fetion.logout();
 }
 
 
}

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.