找回密码
 加入
搜索
查看: 3854|回复: 6

[网络通信] 路过的高手帮忙看一下这个POST![已解决]

[复制链接]
发表于 2011-11-12 14:50:01 | 显示全部楼层 |阅读模式
本帖最后由 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实例,给小弟参考,从而悟出更多的奥妙!...
发表于 2011-11-13 11:02:59 | 显示全部楼层
不是很懂POST,还是支持一下别沉贴了
发表于 2011-11-13 13:20:14 | 显示全部楼层
可以用xmlhttp,手机用户,一会电脑看看
发表于 2011-11-13 13:21:15 | 显示全部楼层
用xmlhttp,可以省掉消息头、cookie的,手机用户,一会电脑看看
发表于 2011-11-13 15:14:26 | 显示全部楼层

$xmlhttp=ObjCreate("Microsoft.XMLHTTP")
$poststr="q_4867%5B%5D=32517&poll_id=62752"
$xmlhttp.open("post","http://survey.ent.sina.com.cn/polling.php",false)
$xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
$xmlhttp.send($poststr)
$para_txt=BinaryToString($xmlhttp.responseBody)
 楼主| 发表于 2011-11-13 17:29:22 | 显示全部楼层
回复 5# .個朲綉√


这串代码你测试成功了么?
我这边测试没有成功!
不是说不用写HTTP头么?
$xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
为什么要加这句?
按道理来说,这么写应该可以成功才对!..
IP限制我拨号处理并成功换掉了IP,手动可以继续投!
可是POST总是不对,不解啊!...
发表于 2011-11-13 21:46:01 | 显示全部楼层
$xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded")

get不需要这一句,POST必需这句
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-11-1 06:59 , Processed in 0.076763 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表