抓包信息如下
[C#] 纯文本查看 复制代码 POST [url]http://portal.cndifang.com/ajax/ajax.asmx/VoteActivity[/url] HTTP/1.1
Host: portal.cndifang.com
Accept-Language: zh-cn
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_1 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Mobile/11D201 MicroMessenger/5.3
X-Requested-With: XMLHttpRequest
Accept: */*
Referer: [url]http://portal.cndifang.com/toolactive/item.aspx?aid=39&id=2491&did=10066&_openid=&code=00485a69797c2ad284d5f94de0b1f207&state=1[/url]
Content-Type: application/json; charset=UTF-8
Connection: keep-alive
Cookie: ASP.NET_SessionId=wxklytkodw0hshss1nbb0ray
Connection: keep-alive
Content-Length: 86
Origin: [url]http://portal.cndifang.com[/url]
Accept-Encoding: gzip, deflate
{"activityid":39,"itemid":2491,"openid":"oh7iotxR0jqJkmLAXUkRaRkd4-uA_1106","state":1}
实现例子代码
[C#] 纯文本查看 复制代码 HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = "http://portal.cndifang.com/ajax/ajax.asmx/VoteActivity",//URL 必需项
Method = "post",//URL 可选项 默认为Get
IsToLower = false,//得到的HTML代码是否转成小写 可选项默认转小写
Cookie = "ASP.NET_SessionId=wxklytkodw0hshss1nbb0ray",//字符串Cookie 可选项
Referer = "http://portal.cndifang.com/toolactive/item.aspx?aid=39&id=2491&did=10066&_openid=&code=00485a69797c2ad284d5f94de0b1f207&state=1",//来源URL 可选项
Postdata = "{\"activityid\":39,\"itemid\":2491,\"openid\":\"oh7iotxR0jqJkmLAXUkRaRkd4-uA_1106\",\"state\":1}",//Post数据 可选项GET时不需要写
Timeout = 100000,//连接超时时间 可选项默认为100000
ReadWriteTimeout = 30000,//写入Post数据超时时间 可选项默认为30000
UserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_1 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Mobile/11D201 MicroMessenger/5.3",//用户的浏览器类型,版本,操作系统 可选项有默认值
ContentType = "application/json",//返回类型 可选项有默认值
};
item.Header.Add("Origin", "http://portal.cndifang.com");
item.Header.Add("X-Requested-With", "XMLHttpRequest");
HttpResult result = http.GetHtml(item);
string html = result.Html;
string cookie = result.Cookie;
|