【发布时间】:2016-04-01 13:02:58
【问题描述】:
我尝试在 Android 客户端中更新我的 DDNS(无 IP)。
我向以下 URL 发出请求。(Discription)
http://username:password@dynupdate.no-ip.com/nic/update?hostname=mytest.testdomain.com&myip=1.2.3.4
当我使用我的网络浏览器时,一切正常。
"good [ip-address]"
但是我的安卓客户端只得到响应"nochange"
URL url = new URL("http://" + USERNAME + ":" + PASSWORD + "@dynupdate.no-ip.com/nic/update?hostname=" + HOSTNAME + "&myip=" + IP_ADDRESS);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
int i = conn.getResponseCode();
stringBuilder = new StringBuilder();
bufferedReader = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));String line;
while ((line = bufferedReader.readLine()) != null) {
stringBuilder.append(line + "\n");
}
【问题讨论】: