|
1金钱
我按照以下代码模拟手机QQ兴趣部落搜索部落请求,
HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = "http://xiaoqu.qq.com/cgi-bin/bar/search_bar",//URL 必需项
Method = "post",//URL 可选项 默认为Get
IsToLower = false,//得到的HTML代码是否转成小写 可选项默认转小写
Cookie = "",//字符串Cookie 可选项
Referer ="http://xiaoqu.qq.com/mobile/index.html?_wv=1027&_bid=128&sid=AbqawXA6Jlts46q1MAvsGUch",//来源URL 可选项
Postdata = "page=0&num=15&query=小米&bkn=1155402606&r=0.043840001337230206",//Post数据 可选项GET时不需要写
Timeout = 100000,//连接超时时间 可选项默认为100000
ReadWriteTimeout = 30000,//写入Post数据超时时间 可选项默认为30000
UserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/600.1.3 (KHTML, like Gecko) Version/8.0 Mobile/12A4345d Safari/600.1.4",//用户的浏览器类型,版本,操作系统 可选项有默认值
ContentType = "application/x-www-form-urlencoded",//返回类型 可选项有默认值
Allowautoredirect = true,//是否根据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);
}
返回的结果不正确,看不出原因。
谷歌浏览器请求
- Remote Address:
14.18.245.224:80
- Request URL:
http://xiaoqu.qq.com/cgi-bin/bar/search_bar
- Request Method:
POST
- Status Code:
200 OK
- Request Headersview source
- Accept:
*/*
- Accept-Encoding:
gzip, deflate
- Accept-Language:
zh-CN,zh;q=0.8,zh-TW;q=0.6
- Cache-Control:
no-cache
- Connection:
keep-alive
- Content-Length:
64
- Content-Type:
application/x-www-form-urlencoded
- Cookie:
o_cookie=970175321; ptui_loginuin=767621304; pgv_pvid=6798111853; RK=0RfiYvRpQx; pt_clientip=dec70e702c9047b3; pt_serverip=16780a821b41bc96; pt2gguin=o0970175321; uin=o0970175321; skey=@66MiqhPH6; ptisp=ctc; ptcz=3b9485a74fbc8205a2ad0446f16ed542981f8f0eeb35ea21a56181e2454c0e74
- DNT:
1
- Host:
xiaoqu.qq.com
- Origin:
http://xiaoqu.qq.com
- Pragma:
no-cache
- Referer:
http://xiaoqu.qq.com/mobile/index.html
- User-Agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/600.1.3 (KHTML, like Gecko) Version/8.0 Mobile/12A4345d Safari/600.1.4
- X-Requested-With:
XMLHttpRequest
- Form Dataview parsed
- page=0&num=15&query=小米&bkn=1155402606&r=0.043840001337230206
- Response Headersview source
- Connection:
keep-alive
- Content-Encoding:
gzip
- Content-Type:
application/json;charset=utf-8
- Date:
Sat, 02 May 2015 11:03:42 GMT
- Server:
tws
- Transfer-Encoding:
chunked
- Vary:
Accept-Encoding
返回结果
{"retcode":0,"result":{"display_num":11,"errMsg":"ok","errCode":0,"gbar_list":[{"key_word":"","member_count":13485729,"tag":"","name":"小米","img":"http://p.qpic.cn/qqconadmin/0/c7cdb4d0710b46549df7558e410d9395/0","today_thread_count":520,"today_sign_in_count":17421,"bid":10525,"intro":"小米粉儿聚集地"},{"key_word":"小米的森林","member_count":247,"tag":"","name":"小米的森林","img":"http://ugc.qpic.cn/gbar_pic/PiajxSqBRaELucPwLZyZSrMTSpywDnePRQNKoTUI6bbE/","today_thread_count":2,"today_sign_in_count":4,"bid":25986,"intro":" 这是一个原创的奇幻,诡异的悬疑探险童话 \n 很少有人知道这片森林。森林的曾经是个文明的世界,在一次虫怪的冲袭下丧失了大量的文明,这次冲袭也很快被平息下来,很少有人知道是什么样的力量平息了这次动荡,而森林开始走向另一种平衡,这个平衡持续了大约十二年。而在最近的时间里,森林里开始出现了异常的现象,是不是又是一场灾难的预示? \n 在一次旅途中,小米与师傅误闯入这片森林。因为师傅的失踪,小米在森林里孤身一人,遇到老人洪九后得知这不是一片普通的森林,并且,小米身上出现了奇怪的印痕,身负重病。洪九答应小米帮他寻找草药,离开的时候将小米交给雪驼大米。 \n 寻找失去踪影的师傅,身负重病的自己,森林中从未见过的各种生物……小米与大米一起,开始了这片森林中危险的旅程。"},{"key_word":"","member_count":13527,"tag":"","name":"小米电视","img":"http://p.qpic.cn/qqconadmin/0/d756beab789d472b8b44d3cac4c5bb98/0","today_thread_count":8,"today_sign_in_count":123,"bid":13845,"intro":"小米电视,年轻人的第一台电视"},{"key_word":"","member_count":43569,"tag":"","name":"小米电视","img":"http://p.qlogo.cn/gbar_heads/16sPWtUNx6PzDziaTZRsPZCAl5AaWDSHIymH3myWN7WY/","today_thread_count":0,"today_sign_in_count":15,"bid":190376,"intro":"小米电视微社区是小米电视微信粉丝的汇集地,让大家在小米电视微社区谈论小米电视的玩机技巧以及分享使用小米电视的使用心得。"},{"key_word":"","member_count":12857,"tag":"","name":"小米应用商店","img":"http://p.qpic.cn/qqconadmin/0/509262ecb4ad4d718cc33ab06628de16/0","today_thread_count":2,"today_sign_in_count":83,"bid":17423,"intro":"发现最好玩的安卓应用和游戏"},{"key_word":"","member_count":192,"tag":"","name":"邰正宵","img":"http://p.qlogo.cn/gbar_heads/Q3auHgzwzM4aGslBCgEzwusuWDK7JRJRWzrNLgtaDTWib0kWZiaYK2dw/","today_thread_count":0,"today_sign_in_count":4,"bid":13785,"intro":"邰正宵粉丝小米聚集地"},{"key_word":"","member_count":319,"tag":"","name":"郑国霖","img":"http://p.qlogo.cn/gbar_heads/Q3auHgzwzM72FGt3TBgt8ofwthUWicdyfAMQl9O0eUictv0viaLufRwqw/","today_thread_count":0,"today_sign_in_count":8,"bid":17239,"intro":"让小米和锅子在一起变成粥~"},{"key_word":"","member_count":1113,"tag":"","name":"数码港","img":"http://p.qlogo.cn/gbar_heads/Q3auHgzwzM5picyN2ILKaCfG4yicMjU4YPyQRe98SMTj0oFnqiaAaQ24g/","today_thread_count":3,"today_sign_in_count":7,"bid":207592,"intro":"3c数码发烧友,苹果三星小米go。"},{"key_word":"金太狼的幸福生活","member_count":60,"tag":"","name":"金太狼的幸福生活","img":"http://ugc.qpic.cn/gbar_pic/PiajxSqBRaEKlicjbuJUN7jMATTMwHia0c15sFJ1jhLDT8/","today_thread_count":0,"today_sign_in_count":0,"bid":23695,"intro":" 北京某娱乐报社记者小米(李小璐 饰)与妇产科医生金亮(王雷 饰)地下恋多年,偷偷领了结婚证。此事在小米家引起了轩然大波。小米父母早年离婚,母亲王淑华(宋丹丹 饰)寡居,而父亲米范(范明 饰)已经续弦。本来,王淑华希望小米找个北京男,谁想冒出个北漂男,而且还生命煮成熟饭。 这令她大为恼火,大动干戈,心脏病都犯了,在前夫的劝说下,好歹接受了这个现实。不过,办婚礼的地点又却引发了双方新的战争。来自东北煤矿金亮爸为他们购置了新房,并进行了装修。但是希望婚礼在沈阳举行。这遭到了王淑华的坚决反对,她坚持婚礼要在北京办。后来,小两口为了都不得罪,打算改旅行结婚。结果,王淑华坚持要陪小两口旅行结婚当电灯泡……双方互不相让,你来我往,各显神通。令金亮与小米夹在中间,左右为难。他们的爱情经受得住这此起彼伏的考验吗?"},{"key_word":"孤胆特工","member_count":43,"tag":"","name":"孤胆特工","img":"http://ugc.qpic.cn/gbar_pic/PiajxSqBRaEKtb7vRXRC7eZCibkR9XCftghxglDRRlcIY/","today_thread_count":0,"today_sign_in_count":4,"bid":28145,"intro":" 住在小女孩小米(金赛纶 饰)隔壁的当铺大叔(元斌 饰)除过生意之外和邻居们从不来往,颓废的造型以及沉默的性格让人们对于他的身份有诸多怀疑。天真的小米从不理会这些传言,时常造访这位神秘邻居竟然使他俩慢慢的成为朋友。小米的妈妈牵连到黑帮的毒品抢夺之中,最终使自己和小米陷入危险之中。目睹小米和妈妈被人绑架的当铺大叔为了救出小米和妈妈,开始和黑道展开斗争。此时,警方也在着手调查这起案件,当铺大叔元泰锡的真正身份慢慢浮出水面。被摘除所有值钱器官的小米妈妈的尸体在一辆汽车的后备箱里被发现,但是,和她一起失踪的小米却依然下落不明…… \n 《旅行者》中扮演“真希”的小罗莉金赛纶和换上颓废造型的“花样美男”元斌一起演绎的韩版《这个杀手不太冷》,成为2010年韩国最卖座的电影。"},{"key_word":"神犬奇兵","member_count":182,"tag":"","name":"神犬奇兵","img":"http://ugc.qpic.cn/gbar_pic/PiajxSqBRaEI0fTTNBS8NXiblHXgmiavvERegrvHbuBQicQ/","today_thread_count":1,"today_sign_in_count":7,"bid":24992,"intro":" 在各种刑事案件以及军事行动的执行过程中,警犬和军犬是任务成功与否不可或缺的关键所在。某次边境缉毒行动中,无意中破坏了班长计划的炊事班长郭油子(杨烁 饰)先后发现了很像狼却十分有灵性的野狗“步枪”以及活泼乖巧的拉布拉多“小米”。谁知在之后的行动中意外加入的小狗竟然起了重要的作用。经过严格的训练,步枪和小米逐渐长大,连同有着军犬血统的滔滔等一同成为保家卫国的犬兵战士。 \n 任务一次比一次艰巨,敌人一个比一个狡猾,我们的神犬奇兵却从未退缩,它们义无返顾地扑向犯罪分子,捍卫着至高无上的正义与和平……"}],"seg_list":[{"seg_str":"CA:0"},{"seg_str":"小米"}],"isend":1}}
|
|