微信好友列表實現調用,微信好友列表

/**
 * 訪問用戶管理 獲取關注列表
 * @param pagesize 單頁數量(測試能夠設置爲9999,一次取所有用戶)
 * @param pageidx 當前頁數(0開始)
 * @return
 * @throws HttpException
 * @throws IOException
 */
public static List<FansJson> getfans(int pagesize, int pageidx) throws HttpException, IOException {
    GetMethod get = new GetMethod("http://mp.weixin.qq.com/cgi-bin/contactmanage?t=user/index&pagesize=" + pagesize + "&pageidx=" + pageidx + "&type=0&groupid=0&token=" + TOKEN + "&lang=zh_CN");
    get.setRequestHeader(USER_AGENT_H, USER_AGENT);
    get.setRequestHeader(REFERER_H, INDEX_URL);
    get.setRequestHeader("Cookie", cookiestr);
    int status = client.executeMethod(get);
    if (status == HttpStatus.SC_OK) {
        String sr = get.getResponseBodyAsString();
        return parseFansCount(sr);

    }
    return null;
}
相關文章
相關標籤/搜索