首页 > 编程知识 正文

java微信开发平台,微信公众号api

时间:2023-05-05 13:09:12 阅读:141394 作者:336

微信客服消息提醒:

publicstaticvoidtest (string OpenID ) throws Exception{。

strJson =''msgtype':'text ',';

strJson =''text':{ ';

strJson =''content': '在这里写下你要出示的信息! ' ';

strJson ='}} ';

post(URL,strJson );

}

publicstaticvoidpost(stringURL,String json )。

try{

//s.setcontentencoding(utf-8 );

s.set content type (application/JSON );

post.setentity(s );

RES.get statusline (.get status code )==HttpStatus.SC_OK ) ) )

}

}catch(exceptione ) {

thrownewruntimeexception(e );

}

}

publicclassgetweixinaccesstoken {

public static String getToken ()

try{

http客户端http客户端=new http客户端(;

getmethodgetmethod=newgetmethod (URL;

int execute=http client.execute method (get method;

getresponse=get method.getresponsebodyasstring (;

}catch(ioexceptione ) {

e .打印任务跟踪(;

}

jsonobjectjson=JSON object.from object (getresponse );

return JSON.getstring (access _ token );

}

}

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。