为什么http://short.weixin.qq.com/cgi-bin/micromsg-bin/geta8key的返回为空

zyoung 发布于 2013/08/31 11:56
阅读 4K+
收藏 0

我用java模拟操作http://short.weixin.qq.com/cgi-bin/micromsg-bin/geta8key这个请求,返回的结果为什么为空?

代码如下:

public static String getOctetStream(HttpClient client, String url,
			String userAgent) throws ClientProtocolException, IOException {

		HttpPost post = new HttpPost(url);
		post.addHeader("Host", "short.weixin.qq.com");
		post.addHeader("Cache-Control", "no-cache");
		post.addHeader("Connection", "Keep-Alive");
		post.addHeader("accept", "*/*");
		post.addHeader("User-Agent", "Android QQMail HTTP Client");
		post.addHeader("Content-Type", "application/octet-stream");

		HttpResponse response = client.execute(post);
		HttpEntity entity = response.getEntity();
		String content = EntityUtils.toString(entity, "UTF-8");
		EntityUtils.consume(entity);
		
		System.out.println(content);
		
		return content;
	}


加载中
返回顶部
顶部