package okhttp;import okhttp3.OkHttpClient;import okhttp3.Request;import okhttp3.Response;import java.io.IOException;public class OkHttpCalendarDemo {public static void main(String[] args) {// getQr();getBind();// getunBind();}// 获取二维码static void getQr() {OkHttpClient client = new OkHttpClient();// String url="http://wechatservice.yadoai.com/wxsmartcal/codeservice/wxdeviceqrcode?auth=yedu123&deviceid=112233";String deviceId = "test333";String url = "http://124.223.72.93/wxsmartcal/codeservice/wxdeviceqrcode?auth=yedu123&deviceid=" + deviceId;get(client, url);}// 获取绑定关系static void getBind() {//400OkHttpClient client = new OkHttpClient();String deviceId = "test333";String url = "http://124.223.72.93/wxsmartcal/apiservice/getwxbind?auth=yedu123&deviceid=" + deviceId;get(client, url);}// 解除绑定关系static void getunBind() {//400OkHttpClient client = new OkHttpClient();String deviceId = "test333";String url = "http://124.223.72.93/wxsmartcal/apiservice/wxunbind?auth=yedu123&deviceid=" + deviceId;get(client, url);}private static void get(OkHttpClient client, String url) {// 创建GET请求Request request = new Request.Builder().url(url).build();try {// 发送请求并获取响应Response response = client.newCall(request).execute();// 检查响应是否成功if (response.isSuccessful()) {// 获取响应体数据String responseData = response.body().string();System.out.println("Response: " + responseData);} else {System.out.println("Request failed with code: " + response.code());}} catch (IOException e) {e.printStackTrace();}}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。