httpclient就行了,给你个取IP的例子好了
import java.io.IOException;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.PostMethod;
public class IPHelper {
public String getSourceText(String ip) throws IOException {
String text = null;
HttpClient client = new HttpClient();
client.getParams().setContentCharset("GBK");
PostMethod post = new PostMethod("
http://www.ip138.com/ips8.asp");
NameValuePair[] data = { new NameValuePair("action", "2"),
new NameValuePair("ip", ip) };
post.setRequestBody(data);
client.executeMethod(post);
text = post.getResponseBodyAsString();
post.releaseConnection();
return text;
}
public static void main(String[] args) throws IOException {
IPHelper h=new IPHelper();
System.out.println(h.getSourceText("192.169.0.1"));
}
}
这个是Post的,还有Get的,看你的form是怎么样的了。