大家帮忙看看,一个投票程序,为什么服务器端不能接收到Referer的值呢?
写入欺骗代码如下:(下面代码中的ip为某个网站的ip地址或者是某个网址)$oHTTP = ObjCreate("microsoft.xmlhttp")
$oHTTP.Open("post", "http://ip/jieshou.asp", False)
$oHTTP.setRequestHeader("Accept-Encoding", "gzip, deflate")
$oHTTP.setRequestHeader("Accept-Language", "zh-cn")
$oHTTP.setRequestHeader("Cache-Control", "no-cache")
$oHTTP.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
$oHTTP.setRequestHeader("Host", "ip")
$oHTTP.setRequestHeader("Referer", "http://ip/input.html")
$oHTTP.Send("ck1=%D5%C5%C8%FD&ck1=%C0%EE%CB%C4&Submit=%CC%E1%BD%BB");post投票
我写程序后,然后在服务器端简写一个jieshou.asp程序,检测接收到的数据,发现发送的表单数据还可以,能够接收得到,
但用Request.ServerVariables("HTTP_REFERER")检测Referer头信息,却是空的,没有接收的到通过语句:$oHTTP.setRequestHeader("Referer", "http://ip/input.html")
设置的头信息,为什么呢?
请大家赐教。如果有人研究够winhttp的新写法,也可以发上来大家一起研究 高手朋友们,您在哪呀??????? 回复 1# sdwd_lhq
xmlhttp 是98时代的产物,呵呵...不支持referer不支持Cookies,为何要用呢?
想要用的话,至少要ServerXmlhttp 5.0以上,推荐直接 winhttp 就好了。 回复 3# republican
我也想用au3中提供的winhttp,但我怎么试也没有发送成功,服务器端的jieshou.asp文件什么都接收不到:
服务器的地址:192.168.0.1web的端口为801,
录入网页:http://192.168.0.1:801/input.html
接收网页:http://192.168.0.1:801/jieshou.asp
我把httpwatch抓取得信息如下:
POST /jieshou.asp HTTP/1.1
Accept: application/x-shockwave-flash, image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/msword, application/vnd.ms-excel, application/vnd.ms-powerpoint, */*
Referer: http://192.168.0.1:801/input.html
Accept-Language: zh-cn
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
Host: 222.135.111.108:801
Content-Length: 53
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: lzstat_uv=267122783216614645|2575321
ck1=%D5%C5%C8%FD&ck1=%C0%EE%CB%C4&Submit=%CC%E1%BD%BB
我运用winhttp写的代码如下:
Global $sPostData = "ck1=%D5%C5%C8%FD&ck1=%C0%EE%CB%C4&Submit=%CC%E1%BD%BB"
$saddress = "192.168.0.1"
; 初始化并获得会话句柄
Global $hOpen = _WinHttpOpen()
; 获取连接句柄
Global $hConnect = _WinHttpConnect($hOpen, $saddress, 801)
; Request
Global $hRequest = _WinHttpOpenRequest($hConnect, _
"POST", _ ; verb
"http://192.168.0.1:801/jieshou.asp", _ ; target
Default, _ ; version
"http://192.168.0.1:801/input.html", _ ; referer
"*/*") ; accept
; 确保启用 cookies
_WinHttpSetOption($hRequest, $WINHTTP_OPTION_DISABLE_FEATURE, $WINHTTP_DISABLE_COOKIES)
; 添加到请求头的字段
$jg = _WinHttpAddRequestHeaders($hRequest, "Accept-Language: zh-cn")
$jg = _WinHttpAddRequestHeaders($hRequest, "Content-Type: application/x-www-form-urlencoded")
$jg = _WinHttpAddRequestHeaders($hRequest, "Accept-Encoding: gzip, deflate")
$jg = _WinHttpAddRequestHeaders($hRequest, "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)")
$jg = _WinHttpAddRequestHeaders($hRequest, "Host: 192.168.0.1:801")
$jg = _WinHttpAddRequestHeaders($hRequest, "Connection: Keep-Alive")
$jg = _WinHttpAddRequestHeaders($hRequest, "Cache-Control: no-cache")
; 发送
_WinHttpSendRequest($hRequest, -1, $sPostData)
好心人帮我看看,好吗?
页:
[1]