错误如下:
[20-7-2 11:10:35:916 CST] 00000028 SystemOut O trytrytrytrytrytrytrytrytrytry
[20-7-2 11:10:35:916 CST] 00000028 SystemOut O 1111111111111111
[20-7-2 11:10:35:916 CST] 00000028 SystemOut O urlStr--http://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx59fcee41cd6332a2&secret=e2c516dc7003cc6c0bbfee3ebbc18e98
[20-7-2 11:10:35:958 CST] 00000028 SystemOut O str---{"errcode":43003,"errmsg":"require https hints: [EfAd244ce-SFCF8!]"}
[20-7-2 11:10:35:958 CST] 00000028 SystemOut O str3---errmsg
[20-7-2 11:10:35:958 CST] 00000028 SystemOut O accesstoken---errmsg
部分代码如下:
System.out.println("trytrytrytrytrytrytrytrytrytry");
String jsonstring = "";
String jsonstringnew="";
System.out.println("1111111111111111");
String urlStr="http://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=xxxxxx&secret=xxxxxxxx";
//String urlStr="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=zzzzzzz&secret=zzzzzzz";
System.out.println("urlStr--"+urlStr);
URL url;
url = new URL(urlStr);
URLConnection urlConnection=url.openConnection();
InputStream in=urlConnection.getInputStream();
InputStreamReader read=new InputStreamReader(in,Charset.forName("UTF-8"));
BufferedReader bread=new BufferedReader(read);
String str1=null;
StringBuffer strb=new StringBuffer();
if(null!=(str1=bread.readLine())){
strb.append(str1);
}
bread.close();
read.close();
in.close();
String str=strb.toString();
System.out.println("str---"+str);
String[] ss = str.split("\"");
String str3 = ss[3];
System.out.println("str3---"+str3);
String accesstoken=str3;
System.out.println("accesstoken---"+accesstoken);
String urlStr1="https://api.weixin.qq.com/cgi-bin/get_current_selfmenu_info?access_token="+accesstoken;
URL url1=new URL(urlStr1);
URLConnection urlConnection1=url1.openConnection();
InputStream in1=urlConnection1.getInputStream();
InputStreamReader read1=new InputStreamReader(in1,Charset.forName("UTF-8"));
BufferedReader bread1=new BufferedReader(read1);
String str2=null;
StringBuffer strb1=new StringBuffer();
if(null!=(str2=bread1.readLine())){
strb1.append(str2);
}
bread.close();
read.close();
in.close();
String str34=strb1.toString();