Plivo SMS 未发送并且在 Java 中出现错误
Plivo SMS is not being sent and getting error in Java
我正在将 Plivo SMS API 与我的 java 网络应用程序集成。我想通过我的应用程序发送消息。我指的是 https://www.plivo.com/docs/getting-started/send-a-single-sms/ link。
下面是代码片段:
String authId = "{my Auth_id}"; //Your Authentication ID
String authToken = "{my auth Token}"; //Your authentication code
RestAPI api = new RestAPI(authId, authToken, "v1");
LinkedHashMap<String, String> parameters = new LinkedHashMap<String, String>();
parameters.put("src", "+44*******"); // Sender's phone number with country code
parameters.put("dst", "+91*******"); // Receiver's phone number with country code
parameters.put("text", "Hi, text from Plivo"); // Your SMS text message
try {
// Send the message
MessageResponse msgResponse = api.sendMessage(parameters);
// Print the response
System.out.println(msgResponse);
// Print the Api ID
System.out.println("Api ID : " + msgResponse.apiId);
// Print the Response Message
System.out.println("Message : " + msgResponse.message);
if (msgResponse.serverCode == 202) {
// Print the Message UUID
System.out.println("Message UUID : " + msgResponse.messageUuids.get(0).toString());
} else {
System.out.println(msgResponse.error);
}
} catch (PlivoException e) {
System.out.println(e.getLocalizedMessage());
}
我尝试使用控制台应用程序和 Web 运行 此代码 application.I 遇到异常 "com.plivo.helper.exception.PlivoException: Connection to https://api.plivo.com refused"。我的代码有什么问题?我在这里错过了什么吗?
这里是 Plivo 销售工程师。
请检查您的防火墙设置以确保它没有阻止任何流量。另外,您是否使用网络代理?如果是,请确保您的应用程序正在使用此代理来处理连接。
我正在将 Plivo SMS API 与我的 java 网络应用程序集成。我想通过我的应用程序发送消息。我指的是 https://www.plivo.com/docs/getting-started/send-a-single-sms/ link。 下面是代码片段:
String authId = "{my Auth_id}"; //Your Authentication ID
String authToken = "{my auth Token}"; //Your authentication code
RestAPI api = new RestAPI(authId, authToken, "v1");
LinkedHashMap<String, String> parameters = new LinkedHashMap<String, String>();
parameters.put("src", "+44*******"); // Sender's phone number with country code
parameters.put("dst", "+91*******"); // Receiver's phone number with country code
parameters.put("text", "Hi, text from Plivo"); // Your SMS text message
try {
// Send the message
MessageResponse msgResponse = api.sendMessage(parameters);
// Print the response
System.out.println(msgResponse);
// Print the Api ID
System.out.println("Api ID : " + msgResponse.apiId);
// Print the Response Message
System.out.println("Message : " + msgResponse.message);
if (msgResponse.serverCode == 202) {
// Print the Message UUID
System.out.println("Message UUID : " + msgResponse.messageUuids.get(0).toString());
} else {
System.out.println(msgResponse.error);
}
} catch (PlivoException e) {
System.out.println(e.getLocalizedMessage());
}
我尝试使用控制台应用程序和 Web 运行 此代码 application.I 遇到异常 "com.plivo.helper.exception.PlivoException: Connection to https://api.plivo.com refused"。我的代码有什么问题?我在这里错过了什么吗?
这里是 Plivo 销售工程师。
请检查您的防火墙设置以确保它没有阻止任何流量。另外,您是否使用网络代理?如果是,请确保您的应用程序正在使用此代理来处理连接。