• Java获取永久图文素材中的网页端Url


    package com.epalmpay.test;

    import com.alibaba.fastjson.JSON;
    import com.epalmpay.util.HttpClientUtil;
    import com.epalmpay.util.wxPhotoUpload;
    import com.riversoft.weixin.common.oauth2.AccessToken;
    import net.sf.json.JSONObject;

    import java.util.HashMap;
    import java.util.Map;


    public class Test01 {



    public static void main(String[] args) throws Exception {

    String appid = "xxxxx";
    String secret = "xxxxx";
    AccessToken token = wxPhotoUpload.getAccessToken(appid,secret);
    String access_token = token.getAccessToken();
    String webUrl = "https://api.weixin.qq.com/cgi-bin/material/get_material?access_token="+access_token;
    Map map = new HashMap();
    map.put("media_id", "NyLawrJYev9kPkz31vESbzwyCGk9Vq5-XgQCoa8aGiI");
    String s = JSON.toJSONString(map);
    String webMessageUrl= HttpClientUtil.post(webUrl,s);
    JSONObject object = JSONObject.fromObject(webMessageUrl);
    net.sf.json.JSONObject resultJSON = net.sf.json.JSONObject.fromObject(object);
    String back = String.valueOf(resultJSON.get("news_item"));
    back = back.substring(1, back.length() - 1);
    net.sf.json.JSONObject resultJSON1 = net.sf.json.JSONObject.fromObject(back);
    if (resultJSON1.get("url") != null) {
    webMessageUrl = resultJSON1.getString("url");
    System.out.println(webMessageUrl);
    }
    }
    }
  • 相关阅读:
    在VMWare的虚拟机中设置共享文件夹(Linux-Ubuntu系统)
    得到cell视图
    推送
    常用框架
    截屏
    多线程枷锁
    java与IOS的交互
    缓存机制
    iOS数据库操作(使用FMDB)
    插入排序
  • 原文地址:https://www.cnblogs.com/jabez1992/p/9875911.html
Copyright © 2020-2023  润新知