python伪造HTTP-REFERER
HTTP Referer是header的一部分,当浏览器向web服务器发送请求的时候,一般会带上Referer,告诉服务器我是从哪个页面链接过来的,服务器籍此可以获得一些信息用于处理。用于统计访问量、防外连接等。
import httplib,urllib2
import random
import time
i = 0
while 1:
a = random.random()
b = str(a)
url = 'http://page.vote.qq.com/survey.php?PjtID=2439626&SubjID=2493278&OptID=184964&fmt=json&result=0&rdm='+b+'05827'
httplib.HTTPConnection.debuglevel = 1
request = urllib2.Request(url)
request.add_header("Accept", "*/*")
request.add_header('Referer', "http://v.qq.com/zt2012/cstvf2012/tvactor.htm")
request.add_header("Accept-Language", "zh-cn")www.zzzyk.com
request.add_header("User-Agent", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; MyIE9; BTRS123646; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)")
request.add_header("Accept-Encoding", "gzip, deflate")
request.add_header("Host", "page.vote.qq.com")
request.add_header("Connection", "Keep-Alive")
opener = urllib2.build_opener()
f = opener.open(request)
print f.url
i += 1
print i
time.sleep(60)
补充:Web开发 , Python ,