您的位置:首页 > 编程语言 > C#

c# 模拟用户登录

2013-09-23 08:15 232 查看
string uriString = http://www.xxx.com/; string postString = "name=xxxx&passwd=xxxx";
WebClient webClient = new WebClient();
webClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
byte[] postData = Encoding.Default.GetBytes(postString);
byte[] responseData = webClient.UploadData(uriString, "POST", postData);
string srcString = Encoding.UTF8.GetString(responseData);
if (srcString.IndexOf("xxx") > 0)
{
Console.WriteLine("xxx");
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: