- 积分
- 40165
- 好友
- 记录
- 主题
- 帖子
- 听众
- 收听
|
发表于 2013-10-11 17:27:35
|
显示全部楼层
- ------WebKitFormBoundarywBQJpN7uNhoEQRvX
- Content-Disposition: form-data; name="method"
- uploadDepositSubmit
- ------WebKitFormBoundarywBQJpN7uNhoEQRvX
- Content-Disposition: form-data; name="theFile"; filename="1111.txt"
- Content-Type: text/plain
- 111111111111111111111111111
- 22222222222222222
- 33333333333333
- ------WebKitFormBoundarywBQJpN7uNhoEQRvX
- Content-Disposition: form-data; name="inputDeposit_0"
- 0
- ------WebKitFormBoundarywBQJpN7uNhoEQRvX--
复制代码 这是PostData
而你的Content-Type属性要设置成这个才有效multipart/form-data; boundary=----WebKitFormBoundarywBQJpN7uNhoEQRvX
用生成器生成的代码应该是这样
[code=csharp] HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = "https://www.bpost.be/BpiShippingCorner/uploadParcelDeposit.do",//URL 必需项
Method = "post",//URL 可选项 默认为Get
IsToLower = false,//得到的HTML代码是否转成小写 可选项默认转小写
Cookie = "SegmentSelectionCookie=Particuliers; SiteSelectionCookie=EN; __utma=76768454.1014965938.1381374181.1381389120.1381479802.3; __utmb=76768454.2.10.1381479802; __utmc=76768454; __utmz=76768454.1381374181.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); JSESSIONID=EB9E4F3BF90766DCB3789C033C4C8084.osp-v000113-pr-node1; __utma=1.710150988.1381373843.1381477528.1381479813.6; __utmb=1.7.10.1381479813; __utmc=1; __utmz=1.1381373843.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)",//字符串Cookie 可选项
Referer ="https://www.bpost.be/BpiShippingCorner/uploadParcelDeposit.do?method=uploadParcelDeposit&be.post.common.menu.MenuBase.SELECTED=uploadParcelDeposit",//来源URL 可选项
Postdata = "------WebKitFormBoundarywBQJpN7uNhoEQRvX
Content-Disposition: form-data; name="method"
uploadDepositSubmit
------WebKitFormBoundarywBQJpN7uNhoEQRvX
Content-Disposition: form-data; name="theFile"; filename="1111.txt"
Content-Type: text/plain
111111111111111111111111111
22222222222222222
33333333333333
------WebKitFormBoundarywBQJpN7uNhoEQRvX
Content-Disposition: form-data; name="inputDeposit_0"
0
------WebKitFormBoundarywBQJpN7uNhoEQRvX--",//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 = "multipart/form-data; boundary=----WebKitFormBoundarywBQJpN7uNhoEQRvX",//返回类型 可选项有默认值
Allowautoredirect = false,//是否根据301跳转 可选项
//CerPath = "d:\123.cer",//证书绝对路径 可选项不需要证书时可以不写这个参数
//Connectionlimit = 1024,//最大连接数 可选项 默认为1024
ProxyIp = "",//代理服务器ID 可选项 不需要代理 时可以不设置这三个参数
//ProxyPwd = "123456",//代理服务器密码 可选项
//ProxyUserName = "administrator",//代理服务器账户名 可选项
};
HttpResult result = http.GetHtml(item);
string html = result.Html;
string cookie = result.Cookie;
[/code] |
|