接入9588短信网关(http协议),9588的iis上的短信服务url需要身份验证,
在程序中使用的URL:http://UserName:Password@000.000.000.000/SmbpHttpAgent/
接入java代码:
URL url = new URL(buf.toString()); System.out.println("****"+buf.toString() );
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
String password = "user:password;
BASE64Encoder base = new BASE64Encoder();
String encodedPassword = base.encode(password.getBytes());
conn.setRequestProperty("Authorization", "Basic " + encodedPassword);
conn.setRequestMethod("GET");
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
while(in.readLine()!=null){ out.println(in.readLine()); bool = true; }
接入asp代码
function SendMes