url:www.twilio.com
可以给手机发短信,打电话啥的。
额度见:http://blog.csdn.net/zxjohnson/article/details/79350151
可以用 textnow 的号码注册,接收注册验证码。
昨天看 ibm 服务有个 sms
注册 twilio(需要爱国),
重要的是
Twilio Account SID
Twilio Auth Token
Twilio Phone Number(Twilio 给的号码)
github:https://github.com/twilio/twilio-java
<dependency>
<groupId>com.twilio.sdk</groupId>
<artifactId>twilio-java-sdk</artifactId>
<version>7.0.0-rc-10</version>
</dependency>
import com.twilio.sdk.Twilio;
import com.twilio.sdk.creator.api.v2010.account.MessageCreator;
import com.twilio.sdk.resource.api.v2010.account.Message;
import com.twilio.sdk.type.PhoneNumber;
public class TwilioUtils {
String accountSid = "Your Account SID"; // Your Account SID from www.twilio.com/user/account
String authToken = "Your Auth Token"; // Your Auth Token from www.twilio.com/user/account
public String sendSMS(String phone,String content) {
Twilio.init(accountSid, authToken);
MessageCreator messageCreator = Message.create(
accountSid,
new PhoneNumber(phone), // To number
new PhoneNumber("Twilio Phone Number"), // From number
content // SMS body
);
Message message = messageCreator.execute();
return message.getSid();
}
public static void main(String[] args) {
TwilioUtils twiliUtils = new TwilioUtils();
twiliUtils.sendSMS("+86 183 XXX XXX","hello world");
}
}
遇到问题:
Permission to send an SMS has not been enabled for the region indicated by XXXXXX
这个要在网页上在勾选 china
The number +86183XXXXXXX is unverified. Trial accounts cannot send messages to unverified numbers;verify +86183XXXXXXX at twilio.com/user/account/phone-numbers/verified, or purchase a Twilio number to send messages to unverified numbers.
这个手机号在页面上验证一下:twilio.com/user/account/phone-numbers/verified
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于