|
本帖最后由 bdancerlc 于 2011-12-8 00:15 编辑
小弟正在学习post相关的知识!
看了好多帖子,回复之类的!.
现在有点糊涂了...
有的要写消息头,这样的方式我试过,可是总是提交不成功!
这个要写消息头的方式有许多困惑:
1、写消息头的时候,网页分析出来的消息头有很多,是需要一个一个都写吗?还是需要筛选过滤?如果要过滤,如何过滤筛选呢?
比如:http://survey.ent.sina.com.cn/survey.php?id=62752&dpc=1(这个投票我拿来测试用的!)
响应头信息原始头信息
Date Sat, 12 Nov 2011 05:18:36 GMT
Server Apache
Set-Cookie U_TRS2=000000f6.4a503f92.4ebe01ac.8f1882da; path=/; domain=.sina.com.cnvote_62752=1; expires=Sat, 12-Nov-2011 06:18:36 GMTBIGipServerpool_dpool2_web2=1443251210.20480.0000; expires=Sat, 12-Nov-2011 05:23:16 GMT; path=/
Location http://survey.ent.sina.com.cn/result/62752.html?f=1
Cache-Control max-age=120
Expires Sat, 12 Nov 2011 05:20:36 GMT
DPOOL_HEADER 10.69.6.86
Content-Length 0
Connection close
Content-Type text/html
请求头信息原始头信息
Host survey.ent.sina.com.cn
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20100101 Firefox/8.0
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language zh-cn,zh;q=0.5
Accept-Encoding gzip, deflate
Accept-Charset GB2312,utf-8;q=0.7,*;q=0.7
Connection keep-alive
Referer http://survey.ent.sina.com.cn/survey.php?id=62752&dpc=1
Cookie U_TRS1=0000008c.a5e14aa3.4e2eb8ba.5c089038; UOR=down1.tech,down.tech,; vjuids=4187f8685.1316681a7e9.0.ff1b1df2ee98d; vjlast=1320899639.1321075108.11; SINAGLOBAL=121.61.9.243.172091311684796422; ULV=1321075110316:52:10:9:000000f6.a8e271b6.4ebe01a4.93cb0688:1321003363447; ALLYESID4=0011090523204545633807; __utma=269849203.835730727.1318501657.1318501657.1318501657.1; __utmz=269849203.1318501657.1.1.utmcsr=baidu|utmccn=(organic)|utmcmd=organic|utmctr=%CF%E0%C7%D7%B6%D4%CF%F3%C8%E7%BA%CE%B2%BB%DE%CF%DE%CE; mvsign=v%3DQV%60v%3Adv0HTCJ%40i8FwC7o; _s_upa=1; Apache=000000f6.a8e271b6.4ebe01a4.93cb0688; SGUP=211522211304221434221a202437092432092c10152dd0a02d50a02d20692dc0552e20652f2024
----------------------------------------------------------------------------------------------------------------------
由于不知道如何筛选设置消息头,所以我把基本上能写上的消息头都写上了!...希望路过的高手指点一二!...huanIP()
$cookie = 'U_TRS1=0000008c.a5e14aa3.4e2eb8ba.5c089038; UOR=down1.tech,down.tech,; vjuids=4187f8685.1316681a7e9.0.ff1b1df2ee98d; vjlast=1320899639.1321075108.11; SINAGLOBAL=121.61.9.243.172091311684796422; ULV=1321075110316:52:10:9:000000f6.a8e271b6.4ebe01a4.93cb0688:1321003363447; ALLYESID4=0011090523204545633807; __utma=269849203.835730727.1318501657.1318501657.1318501657.1; __utmz=269849203.1318501657.1.1.utmcsr=baidu|utmccn=(organic)|utmcmd=organic|utmctr=%CF%E0%C7%D7%B6%D4%CF%F3%C8%E7%BA%CE%B2%BB%DE%CF%DE%CE; mvsign=v%3DQV%60v%3Adv0HTCJ%40i8FwC7o; _s_upa=1; Apache=000000f6.a8e271b6.4ebe01a4.93cb0688; SGUP=211522211304221434221a202437092432092c10152dd0a02d50a02d20692dc0552e20652f2024'
$url = "http://survey.ent.sina.com.cn/polling.php"
$oHTTP = ObjCreate("microsoft.xmlhttp")
$oHTTP.Open("post",$url,false)
$oHTTP.setRequestHeader("Cache-Control", "no-cache")
$oHTTP.setRequestHeader("Accept-Language", "zh-cn")
$oHTTP.setRequestHeader("Connection","keep-alive")
$oHTTP.setRequestHeader("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
$oHTTP.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
$oHTTP.setRequestHeader("Host","survey.ent.sina.com.cn")
$oHTTP.setRequestHeader("Accept-Encoding","gzip, deflate")
$oHTTP.setRequestHeader("Accept-Charset","GB2312,utf-8;q=0.7,*;q=0.7")
$oHTTP.setRequestHeader("Referer","http://survey.ent.sina.com.cn/survey.php?id=62752&dpc=1")
$oHTTP.setRequestHeader("Set-Cookie", "BIGipServerpool_dpool2_web2=1360020490.20480.0000; expires=Thu, 10-Nov-2011 08:26:08 GMT; path=/")
$oHTTP.Send("q_4867%5B%5D=32470&poll_id=62752&x=24&y=17");post投票
_IECreate("http://survey.ent.sina.com.cn/result/62752.html")
Func huanIP()
$Adslname = IniRead(".\userset.ini", "ADSL", "Adslname", "NotFound")
$Adsluser = IniRead(".\userset.ini", "ADSL", "Adsluser", "NotFound")
$Adslpsw = IniRead(".\userset.ini", "ADSL", "Adslpsw", "NotFound")
RunWait(@ComSpec & " /c rasdial " & $Adslname & " /disconnect", "", 0) ;~ADSL断开
Sleep(1000)
RunWait(@ComSpec & " /c rasdial " & $Adslname & " " & $Adsluser & " " & $Adslpsw, "", 0) ;~ADSL断开
EndFunc
---------------------------------------------------------------------------------------------
多抓了几次包,貌似这个cookie是变动的!..
希望多给出几个这个网页的POST实例,给小弟参考,从而悟出更多的奥妙!... |
|