12345678910111213141516171819202122232425262728293031323334 |
- using System.IO;
- namespace CB.Admin.Plugins
- {
- public static class CommunalHelper
- {
- private static HttpHelper _Helper = new HttpHelper();
- /// <summary>
- /// Http请求
- /// </summary>
- /// <param name="url"></param>
- /// <param name="type"></param>
- /// <returns></returns>
- public static string HttpRequest(string url, string type = "text/html")
- {
- HttpItem _item = new HttpItem
- {
- Url = url,
- Method = "get",
- Accept = "text/html",
- ContentType = type,
- Timeout = 90,
- UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"
- };
- //
- HttpResult result = _Helper.GetHtml(_item);
- if ((int)result.StatusCode == 200 && !string.IsNullOrEmpty(result.Html))
- return result.Html;
- else
- return "";
- }
- }
- }
|