java.net.URLConnection
更多信息请Google例子:更新3322的域名package cn.nways.system;import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;import cn.nways.unit.OS;public class Dyndns3322Sun {
private String user ="xxxxxx";
private String password = "xxxxxx";
private String hostName = "xxxxxx.6600.org";

public String reg() {
InputStreamReader read =null;
BufferedReader reader =null;
InputStream input = null;
try {
String up=user + ":"+password;
String qu="dyndns/"+"update?system=dyndns&hostname="+hostName; ;
URL url = new URL("http://members.3322.org/" +qu);
URLConnection conn = url.openConnection();

conn.setRequestProperty("Host", "members.3322.org");
conn.setRequestProperty("Accept", "*/*");
conn.setRequestProperty("Accept-Language", "zh-cn");
conn.setRequestProperty("Accept-Encoding", "gzip, deflate");

conn.setRequestProperty("User-Agent", "myclient/1.0 [email protected]");
conn.setRequestProperty("Connection","Keep-Alive");


String encoding = new sun.misc.BASE64Encoder().encode(up.getBytes());
conn.setRequestProperty("Authorization", "Basic " + encoding); conn.connect();

input = conn.getInputStream();

read = new InputStreamReader(input,"gb2312");
            reader = new BufferedReader(read);
            String line;
            StringBuffer sbout = new StringBuffer("");
            while((line = reader.readLine())!=null){
             sbout.append(line + OS.LINE_S);
            }
            
            String back = sbout.toString();
            if(back.startsWith("good") || back.startsWith("nochg")){
             String[] ss = back.split(" ");
             if(ss.length==2){
             return ss[1];
             }
            }

} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}finally{
if(reader!=null){
             try {
reader.close();
} catch (IOException e) {
}
            }
            if(read !=null){
             try {
read.close();
} catch (IOException e) {
}
            }
            
            if(input!=null){
             try {
input.close();
} catch (IOException e) {
}
            }
}

return null;
}


public static void main(String[] args) {
Dyndns3322Sun dyndns3322 = new Dyndns3322Sun();
String log = dyndns3322.reg();
System.out.println(log);
}
}