package com.duiba.tuia.youtui.web.tool.http;


import org.jsoup.Connection;
import org.jsoup.Jsoup;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

public class JsoupUtil {

    private static Logger logger = LoggerFactory.getLogger(JsoupUtil.class);

    public static String doPost(String url, Map<String, String> param){
        try {
            Connection.Response resp = Jsoup.connect(url).method(Connection.Method.POST).ignoreContentType(true).data(param).timeout(500).execute();
            return resp.body();
        } catch (Exception e) {
            logger.error("调用接口={}失败，reason={}", url, e);
            return "";
        }
    }
}
