HttpClient获得人人相册信息 各位大神,我最近参加了一个比赛。里面要求接入人人社区,但是,他不允许我们利用人人的API。所以,我要自己实现人人的功能,主要是上传照片和下载相册里面的照片。我打算使用HttpClient做。我想知道,有没有人有做过这个东西的经历。有的话,请指点一下。如果有别的Demo,那就最好了。跪求各位大神帮忙啊。PS: 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 登陆renren.com,然后获取相册信息,下载照片都简单,上传照片这个估计会有难度,我现在只是登陆renren.com,然后获取blog。http://blog.csdn.net/iisgirl/article/details/7519760上传照片,这个我稍后试试,试过之后才知道。 httpclient用过,比较熟悉这个了 不用API获取社交网络的信息,思路不错。 String urlPath = "http://m.haatalk.com:9527/file/upload"; HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost(urlPath); MultipartEntity mpEntity = new MultipartEntity(); //file为上传图片 FileBody fileBody = new FileBody(file); mpEntity.addPart("file", fileBody); mpEntity.addPart("userId", new StringBody(uuid,Charset.forName(org.apache.http.protocol.HTTP.UTF_8))); } post.setEntity(mpEntity); HttpResponse response = client.execute(post); String content = EntityUtils.toString(response.getEntity()); System.out.println(content); client.getConnectionManager().shutdown(); 这个我知道,但是,那个比赛是这么要求的啊。他比较牛,不让我们用人人的SDK,我们只能苦逼地自己写。 java中Jtextfield文本框可以输入多少数据 定义变量同时调用其他类方法给变量赋值为什么一定要定义为final? HashSet 的add方法? 困惑:调用外部程序并杀掉外部程序的问题 怎么在java中处理海量数据(加急解决 谢谢了) Servlet的小程序! 大家帮我看看这段很简单的代码 如何解释 下面的 几句 adapter 代码 谁有发送at指令集到串口的程序?java的只要通过,马上给分 SMTP 发信验证怎么解决?谢谢! swing中setTitle的用法 请教一个java字符串处理的问题
String urlPath = "http://m.haatalk.com:9527/file/upload";
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(urlPath);
MultipartEntity mpEntity = new MultipartEntity();
//file为上传图片
FileBody fileBody = new FileBody(file);
mpEntity.addPart("file", fileBody);
mpEntity.addPart("userId", new StringBody(uuid,Charset.forName(org.apache.http.protocol.HTTP.UTF_8)));
}
post.setEntity(mpEntity);
HttpResponse response = client.execute(post);
String content = EntityUtils.toString(response.getEntity());
System.out.println(content);
client.getConnectionManager().shutdown();
他比较牛,不让我们用人人的SDK,我们只能苦逼地自己写。