| | |
| | | /// <param name="method">请求方式为POST/GET</param> |
| | | /// <param name="second">超时时间</param> |
| | | /// <returns></returns> |
| | | public static async System.Threading.Tasks.Task<string> HttpWebRequest(string getUrl, string str, string method, int second = 3) |
| | | public static async System.Threading.Tasks.Task<string> HttpWebRequest(string getUrl, string str, string method, int second = 3, bool _bool = false) |
| | | { |
| | | HttpWebRequest request = WebRequest.Create(getUrl) as HttpWebRequest; //创建请求 |
| | | request.Method = method; //请求方式为POST/GET |
| | | request.ContentType = "application/json"; |
| | | request.ContentType = "application/json"; |
| | | request.Timeout = second * 1000;//超时时间 |
| | | if (_bool) { |
| | | //用于高胜可视对讲接口 |
| | | request.Headers.Add("Authorization", Config.Instance.Token); |
| | | } |
| | | if (method == "POST") |
| | | { |
| | | byte[] jsonbyte = System.Text.Encoding.UTF8.GetBytes(str); |