public static String Post (string _url, string _body, bool is_gbk = false)
{
String _encode = String.Empty;
if (is_gbk == true)
{
_encode = "GB2312";
}
else
{
_encode = "utf-8";
}
string _str = string.Empty;
try
{
HttpItem le_item = new HttpItem ()
{
Method = "post",
URL = _url,
Postdata = _body,
Referer = _url,
UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36",
//Cookie = this.cookie,
Encoding = System.Text.Encoding.GetEncoding (_encode),
Accept = "application/json, text/javascript, */*; q=0.01",
ContentType = "application/x-www-form-urlencoded; charset=UTF-8",
};
//
HttpHelper http = new HttpHelper ();
HttpResult le_http_res = http.GetHtml (le_item);
_str = le_http_res.Html;
}
catch (Exception e)
{
_str = "";
Console.WriteLine (e.Message);
}
return _str;
}
public static String Get (string _url, bool is_gbk = false)
{
String _encode = String.Empty;
if (is_gbk == true)
{
_encode = "GB2312";
}
else
{
_encode = "utf-8";
}
string _str = string.Empty;
try
{
HttpItem le_item = new HttpItem ()
{
Method = "get",
URL = _url,
Referer = _url,
UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36",
//Cookie = this.cookie,
Encoding = System.Text.Encoding.GetEncoding (_encode),
Accept = "application/json, text/javascript, */*; q=0.01",
ContentType = "application/x-www-form-urlencoded; charset=UTF-8",
};
//
HttpHelper http = new HttpHelper ();
HttpResult le_http_res = http.GetHtml (le_item);
_str = le_http_res.Html;
}
catch (Exception e)
{
_str = "";
Console.WriteLine (e.Message);
}
return _str;
}