|
发表于 2014-6-14 12:04:57
|
显示全部楼层
HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = "http://gd.189.cn/dwr/exec/newLoginDwr.goLogin.dwr",//URL 必需项
Method = "post",//URL 可选项 默认为Get
IsToLower = false,//得到的HTML代码是否转成小写 可选项默认转小写
Cookie = "",//字符串Cookie 可选项
Referer ="http://gd.189.cn/common/newLogin/newLogin.htm?SSOArea=020&SSOAccount=null&SSOProType=null&SSORetryTimes=null&SSOError=null&SSOCustType=0&loginOldUri=null&SSOOldAccount=null&SSOProTypePre=null",//来源URL 可选项
Postdata = "callCount=1&c0-scriptName=newLoginDwr&c0-methodName=goLogin&c0-id=7065_1402718060202&c0-param0=boolean:false&c0-param1=boolean:false&c0-param2=string:&c0-param3=string:&c0-param4=string:2000004&c0-param5=string:手机号码&c0-param6=string:00&c0-param7=string:密码&c0-param8=string:&c0-param9=string:&xml=true",//Post数据 可选项GET时不需要写
Timeout = 100000,//连接超时时间 可选项默认为100000
ReadWriteTimeout = 30000,//写入Post数据超时时间 可选项默认为30000
UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",//用户的浏览器类型,版本,操作系统 可选项有默认值
ContentType = "text/html",//返回类型 可选项有默认值
Allowautoredirect = false,//是否根据301跳转 可选项
//CerPath = "d:\123.cer",//证书绝对路径 可选项不需要证书时可以不写这个参数
//Connectionlimit = 1024,//最大连接数 可选项 默认为1024
ProxyIp = "",//代理服务器ID 可选项 不需要代理 时可以不设置这三个参数
//ProxyPwd = "123456",//代理服务器密码 可选项
//ProxyUserName = "administrator",//代理服务器账户名 可选项
ResultType = ResultType.String
};
HttpResult result = http.GetHtml(item);
string html = result.Html;
string cookie = result.Cookie;
/// <summary>
/// 字节数组生成图片
/// </summary>
/// <param name="Bytes">字节数组</param>
/// <returns>图片</returns>
private Image byteArrayToImage(byte[] Bytes)
{
MemoryStream ms = new MemoryStream(Bytes);
return Bitmap.FromStream(ms,true);
}
返回的值为:
|
|