/// <summary>
/// 向Url发送post请求
/// </summary>
/// <param name="postData">发送数据</param>
/// <param name="uriStr">接受数据的Url</param>
/// <returns>返回网站响应请求的回复</returns>
public static string RequestGet(string URL)
{
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(URL);
request.Credentials = CredentialCache.DefaultCredentials;
request.Method = "get";
request.AllowAutoRedirect = true;
request.ContentType = "application/x-www-form-urlencoded";
Stream responseStream = null;
try { responseStream = request.GetResponse().GetResponseStream(); }
catch (Exception e) { throw e; }
string stringResponse = string.Empty;
using (StreamReader responseReader = new StreamReader(responseStream, Encoding.GetEncoding("utf-8")))
{
stringResponse = responseReader.ReadToEnd();
}
responseStream.Close();
return stringResponse;
}