此代码引发错误:
String apikey = "apikey="+"MzA2NTUwMzI1NjM3MzU3NTQ3NDQ3MDZhNzE2NjZlNzI=";
String message = "&message="+"setupViewAfterLogon function is triggering";
String sender = "&sender="+"TXTLCL";
String numbers = "&numbers="+"885105XXXX";
//String message = "&message="+"setupViewAfterLogon function is triggering";
//Send Data
HttpURLConnection conn = (HttpURLConnection) new URL("https://api.textlocal.in/send/?").openConnection();
@SuppressWarnings("deprecation")
String data = apikey + numbers+ URLEncoder.encode(message) +sender;
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Length", Integer.toString(data.length()));
conn.getOutputStream().write(data.getBytes("UTF-8"));
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
StringBuffer stringBuffer = new StringBuffer();
String line;
while((line=rd.readLine())!=null) {
stringBuffer.append(line).append("/n");
}
System.out.println(stringBuffer.toString()+" DATA HAS BEEN SENT");
rd.close();
它抛出错误:
{
"warnings": [
{
"code": 3,
"message": "Invalid number"
}
],
"errors": [
{
"code": 5,
"message": "No message content"
}
],
"status": "failure"
}
我正在发送印度手机号码。格式应该是什么?