110,561
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Net;
namespace alvvtest
{
class Program
{
static void Main(string[] args)
{
string postzf = "pageindex=1";
string url = "http://www.alivv.com/ajax/Alivv.AjaxRun.WebSiteAjax,Alivv.AjaxRun.ashx?_method=BuyerWebSiteList&_session=r";
HttpWebRequest newqq = null;
HttpWebResponse newfh = null;
System.Net.ServicePointManager.Expect100Continue = false;
Uri newurl = new Uri(url);
newqq = (HttpWebRequest)WebRequest.Create(newurl);
string data = postzf;
newqq.Host = "www.alivv.com";
newqq.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; GTB6; .NET CLR 2.0.50727; CIBA)";
newqq.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
newqq.Headers.Add("Accept-Language", "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3");
newqq.Headers.Add("Accept-Encoding", "gzip, deflate");
newqq.Headers.Add("DNT", "1");
newqq.ContentType = "text/plain; charset=UTF-8";
newqq.Referer = "http://www.alivv.com/links_gd.html";
newqq.CookieContainer = new CookieContainer() ;
newqq.Accept = "*/*";
newqq.Method = "POST";
newqq.Timeout = 60000;
//newqq.KeepAlive = true;
//newqqt.AllowAutoRedirect = true;
byte[] byteArray = Encoding.UTF8.GetBytes(data);
Stream stream = newqq.GetRequestStream();
stream.Write(byteArray, 0, byteArray.Length);
stream.Close();
newfh = (HttpWebResponse)newqq.GetResponse();
StreamReader sr = new StreamReader(newfh.GetResponseStream(), Encoding.UTF8);
string fanhuizhi = sr.ReadToEnd();
}
}
}