用HttpClient请求url对应的网页数据,请求不到,求高手解答,在线等
请求的url是:http://list.tmall.com/search_product.htm?spm=3.1000473.254665.12&active=1&from=sn_1_cat&area_code=330100&navlog=1&nav=spu-cat&vmarket=0&style=g&sort=s&start_price=100&n=120&s=0&cat=50096891&is=cate#J_crumbs
写的代码如下:
// 传进去上面的url HttpClient client = new DefaultHttpClient(); try { HttpPost httpPost = new HttpPost(url.trim()); HttpResponse response = client.execute(httpPost); HttpEntity entity = response.getEntity(); if (entity == null) { System.out.println("url content is null:" + url); } System.out.println(EntityUtils.toString(entity);) } catch (Exception e) { e.printStackTrace(); }