日期:2014-05-17 浏览次数:20862 次
static class HTTP_Interaction
{
static public string GetURL(string strURL, string cookie)
{
try
{
HttpWebRequest wr = (HttpWebRequest)HttpWebRequest.Create(strURL);
if (cookie != "")
{
wr.Headers["cookie"] = cookie; //设置cookie
}
using (HttpWebResponse wsp = (HttpWebResponse)wr.GetResponse())
{
using (Stream st = wsp.GetResponseStream())
{
//默认编码读取结果
Encoding DefaultCharset = Encoding.Default; //默认编码
StreamReader sr = new StreamReader(st, DefaultCharset);