public JSONObject getAccessToken(String appid, String secret,String code)
throws Exception {
JSONObject array=null;
HttpGet httpget = null;
try {
httpget= HttpClientConnectionManager
.getGetMethod("https://api.weixin.qq.com/sns/oauth2/access_token?appid="+appid+"&secret="+secret+"&code="+code+"&grant_type=authorization_code");
HttpResponse response = httpclient.execute(httpget);
String jsonStr = EntityUtils.toString(response.getEntity(), "utf-8");
array = JSONObject.fromObject(jsonStr);
} catch (Exception e) {
// TODO Auto-generated catch block
httpget.abort();
e.printStackTrace();
}
return array;
}