第一个是获取签名的函数:
public String getSignature(List<String> paramList,String secret)
不知道第一个参数是什么东西?请高手赐教。
public String getSignature(List<String> paramList,String secret)
不知道第一个参数是什么东西?请高手赐教。
解决方案 »
- Contacts导入Eclipse 出现错误
- 自定义控件问题: 继承自View的自定义控件在Layout配置文件里属性引不出来
- android手机上用Email应用以exchange方式登录gmail 账户,有的账户不能同步邮件
- android调用JAR的问题
- string where = FIELD_id +"= ?"什么意思啊?
- 关于android 自启动程序问题
- 安卓生成jar后 调用出错
- android studio新建模拟器中没选CPU就没法进行下一步了,帮忙看看是什么问题
- Listview 问题。请教各位!
- java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel
- webview载入页面和手机的网有关吗?在线等
- Android是不是还隐藏着一个拨号键盘?
代码如下:就是官网上的代码:
public static void main(String[] args) throws Exception {
long time = System.currentTimeMillis();
String strTime = URLEncoder.encode(String.valueOf(time)); //系统的当前时间,作为call_id的值
String secret = "49617buiyd00404239240f88c8cb3e02"; //应用的Secret Key
String apiKey = "eabd87cf9087486e8f7861b57d91a4ee"; //应用的API Key
String requestMethod = "users.getEvent"; //接口名称
String v = "1.0"; //API的版本号,请设置成1.0
String sessionKey = "7c8dc0bf83a148bc97bfa804b07a1a10-227967782"; //通过上述验证授权过程得到的Session Key,注意需要URL编码
String fields = "notification_count,tag_request_count"; //请求接口所要求的参数,因接口不同而不同,下面接口列表中点击接口名进入的页面会详细介绍
String url = "http://api.renren.com/restserver.do"; //请求人人网开放平台API服务器的地址
String signature = “wierydkf22334324234”; //上述的签名 PostMethod method = new PostMethod(url); //将以上准备好的参数添加到method对象中
method.addParameter("api_key", apiKey);
method.addParameter("method", requestMethod);
method.addParameter("call_id", strTime);
method.addParameter("v", v);
method.addParameter("session_key", sessionKey);
method.addParameter("fields", fields);
method.addParameter("fangle_types", "all");
method.addParameter("sig", signature);
method.addParameter("format", "JSON"); //返回结果的形式,支持XML或者JSON两种形式,默认为XML HttpClient client = new HttpClient();
client.executeMethod(method); String result = method.getResponseBodyAsString(); //返回请求的结果
}
代码中的PostMethod 是什么数据类型,怎么eclipse会报错呢?还有HttpClient client = new HttpClient();也有错误(Cannot instantiate the type HttpClient)。