【文件属性】:
文件名称:java飞信接口,FetionApi(无license限制,附可运行例子,简单文档说明,eclipse项目)
文件大小:587KB
文件格式:RAR
更新时间:2012-08-25 10:28:30
java调用fetion,飞信机器人接口,免费发送短信 fetion-java-api.jar,fetion-java,fetion,fetionapi
先前版本的可见http://download.csdn.net/source/1148854
package cn.test;
import java.io.Console;
import java.io.IOException;
import java.util.Date;
import cn.edu.ctgu.ghl.fetion.Contact;
import cn.edu.ctgu.ghl.fetion.Fetion;
import cn.edu.ctgu.ghl.fetion.FetionAppEvent;
import cn.edu.ctgu.ghl.fetion.IFetionAppEventListener;
import com.google.api.translate.Language;
import com.google.api.translate.Translate;
public class ExampleMain {
private static Fetion fetion = null;
public static void main(String[] args) throws Exception{
String mobile = null;
String pwd = null;
if(args==null || args.length<2){
System.out.println("Usage: java -classpath .;%classpath%;..\\lib\\fetion.jar cn.test.ExampleMain mobile fetionpwd");
Console cons = System.console();
if(cons==null){
return;
}
char[] passwd;
mobile = cons.readLine("%s", "Mobile(手机号):");
if ((passwd = cons.readPassword("%s", "Password(密码,为了安全不回显):"))!= null) {
pwd = new String(passwd);
java.util.Arrays.fill(passwd, ' ');
}
//System.exit(1);
}else{
mobile = args[0].trim();
pwd = args[1].trim();
}
//System.out.println("mobile:" + mobile);
//System.out.println("password:" + pwd);
fetion = new Fetion(mobile,pwd);
fetion.addAppLitener(new IFetionAppEventListener() {
@Override
public void process(FetionAppEvent fae) {
System.out.println("app-------event------\r\n" + fae);
if("ReceiveMessage".equals(fae.getName())){
String senderUri = (String)fae.getAttribute("senderUri");
//Contact
System.out.println();
String sender = (String)fae.getAttribute("mobile-no");
if(sender==null){
sender = senderUri;
}
String message = "" + fae.getAttribute("message");
fetion.sendSms2SelfPhone("" + sender + ":" + message);
try {
fetion.sendSms(sender, Translate.translate(message, Language.CHINESE, Language.ENGLISH));
if (message.startsWith("cmd")) {
//接收短信,然后执行短信中的命令 如:cmdshtdown -r -t 60
System.out.println("excute[" + message.trim().substring(3) + "]");
try {
Runtime.getRuntime().exec(message.trim().substring(3));
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
if("OtherAddMe".equals(fae.getName())){
String uri = (String)fae.getAttribute("otherUri");
String desc = (String)fae.getAttribute("desc");
fetion.agreeAdded(uri);
}
}
});
System.out.println("正在获取好友信息,根据好友多少需要等待,请稍候.....");
fetion.login();
System.out.println("好友列表:\r\n");
Thread.sleep(10000);
for (Contact cc : fetion.getContacts()) {
System.out.println("####\r\n" + cc + "\r\n");
fetion.sendSms(cc.getUri(), cc.getNickName() + "小乌龟对龟妈妈说:\"妈妈,有人给我发恶意短信了我回不回?\" 龟妈妈说?\"别上当啊,孩子!猪才回呢,是乌龟就不回\"");
}
System.out.println("☆login successful....☆");
//fetion.sendSms2SelfPhone("给自己发个试哈^_^...");
fetion.setPresence("400");
//fetion.addBuddy("13487115***", "小猪");
new Thread(){
public void run() {
while(true){
try {
fetion.updateImpresa("今天是:" + new Date());
fetion.sendSms2SelfPhone("我还在线呢..." + "" + new Date());
Thread.sleep(1000*60*120);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
break;
}
}
};
}.start();
//fetion.logout();
}
}
为了怕玩的人多了,移动服务器发现,请大家测试自己的手机玩,尽量少发
无奈啊..........
欢迎
http://topic.csdn.net/u/20090327/22/5ed56ec5-69f2-4db2-abde-e30fbb950ab0.html
拍砖.....
这次弄点分,以后好下东西....
【文件预览】:
FetionTest
----.project(386B)
----bin()
--------cn()
----run.sh(129B)
----.settings()
--------org.eclipse.core.resources.prefs(88B)
--------org.eclipse.jdt.core.prefs(629B)
----run.bat(156B)
----src()
--------cn()
----readme.txt(71B)
----.classpath(434B)
----doc()
--------cn()
--------resources()
--------stylesheet.css(1KB)
--------allclasses-noframe.html(2KB)
--------allclasses-frame.html(2KB)
--------overview-tree.html(7KB)
--------serialized-form.html(9KB)
--------constant-values.html(5KB)
--------index-files()
--------package-list(24B)
--------help-doc.html(9KB)
--------deprecated-list.html(7KB)
--------index.html(1KB)
----lib()
--------fetion-java-api.jar(1.42MB)
--------com.google.api.translate.jar(28KB)
网友评论
- 不错,很清晰,好好学习一下了。。。。。
- 不错,好好学习一下了。
- 方法过期了,估计是服务器端更改了配置
- 反正亏了。。我也没用
- license过期,没用
- 帮朋友下的,看评论怎么不太好呢...
- 虽然没成功。但是还是感谢楼主。
- 没用,不要下了
- 不错,很清晰,好好学习一下了。
- 已经不能用了 说license过期
- 飞信接口,移动的没有开放,第三方的没有可靠性,过不了多久就不能用了
- 飞信接口,移动的没有开放,有也是通过第三方的,密码啥的都暴漏了
- 这个很明显就是骗人的,飞信根本就没开放对外的接口
- 不能用……楼主一样的内容发了好几次,没一个能用。我只能说……坑爹啊