java中如何实现远程调用http来获取返回来的数据,用的是httpClient。也就是向某网站提交些数据,并接收返回的数据。
我从apche里面看到httpClient都是用来获取网页的内容而不是处理返回来的数据。我想要用程序访问一些网站,然后可以得到这个网站返回来给我的数据。
下面是我用httpClient来获取某个网页的内容,但是这不是我想要的结果。希望你们明白我要的是什么。希望你们不要给我提供我下面的代码,这个代码在什么地方都可以看到的。
public class HttpClientSimple {
public static void main(String[] args){
HttpClient httpClient = new HttpClient();
httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(5000);
String url = "http://192.168.1.108:8080/cyberage";
GetMethod getMethod = new GetMethod(url);
getMethod.getParams().setParameter(HttpMethodParams.SO_TIMEOUT,5000);
getMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
new DefaultHttpMethodRetryHandler());
try{
int statusCode = httpClient.executeMethod(getMethod);
if (statusC