📄 example.java
字号:
import com.bv.api.*;import com.bv.api.send.*;import com.bv.api.response.*;import java.util.Vector;public class Example { /* * This is a simple class designed to send a SMS message to a single recipiant specified in the code below. * It requires the BVAPI.jar library to run. This can be obtained from http://www.vodafonebetavine.net. */ public static void main(String args[]) { //Fill in your UAID below Transport t = Transport.getTransport("http://www.vodafonebetavine.net", "uaid"); //Fill in the message and destination below. The number should be in the format <country code><number> e.g. 07700900999 becomes 447700900999 in the UK. SendSMS ss = new SendSMS("message", "number"); try { SendSMSResponse ssr = (SendSMSResponse) t.execute(ss); System.out.println("API Version: " + ssr.getVersion()); System.out.println("Success? " + ssr.isSuccess()); if(ssr.isSuccess()) { System.out.println("Transaction ID:" + ssr.getTransactionId()); Vector ids = ssr.getMessageIds(); for(int i = 0; i < ids.size(); i++) { System.out.println("Message ID: " + ids.get(i)); } } else { System.out.println("Error: " + ssr.getError().getCode() + " " + ssr.getError().getMessage()); } } catch (ParamNotPresentException pnpe) { System.out.println("Error: param not present exception "); Vector<String> v = pnpe.getParams(); for(String param : v) { System.out.println(param); } } catch (InvalidParameterException ipe) { System.out.println("Error: invalid paramter exception " + ipe.getParameter()); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -