Created
January 27, 2012 18:03
-
-
Save kingbin/1690064 to your computer and use it in GitHub Desktop.
http requests to auto vote on a polldaddy poll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open-uri' | |
pollNumber = '5876349' | |
ourPick = '26523547' | |
uriString = 'http://polldaddy.com/n/64270c358614e8ef9383968590e82f73/'.concat(pollNumber).concat('?').concat(Time.now.to_i.to_s()) | |
puts uriString | |
# Headers | |
HEADERS = { | |
'Host' => 'polldaddy.com', | |
'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7', | |
'Referer' => 'http://speakimge.wordpress.com/' | |
# 'Accept' => '*/*', | |
# 'Accept-Language' => 'en-US,en;q=0.8', | |
# 'Accept-Encoding' => 'gzip,deflate,sdch', | |
# 'Accept-Charset' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', | |
# 'Keep-Alive' => '300', | |
# 'Connection' => 'keep-alive', | |
# 'Cache-Control' => 'max-age=0' | |
} | |
puts '------1st Request For The Magic CoOkie!--------' | |
res = open(uriString, HEADERS).read | |
puts res.split(';')[0] | |
cookie = res.split(';')[0][14,32] | |
puts cookie | |
puts '------2nd Request to Cast Our Vote!--------' | |
uriString = 'http://polls.polldaddy.com/vote-js.php?p='.concat(pollNumber).concat('&b=0&a=').concat(ourPick).concat(',&o=&va=0&cookie=0&url=http%3A//speakimge.wordpress.com/2012/01/25/under-the-covers/&n=').concat(cookie) | |
puts uriString | |
HEADERS['Host'] = 'polls.polldaddy.com' | |
HEADERS['Referer'] = 'http://speakimge.wordpress.com/2012/01/25/under-the-covers/' | |
res = open(uriString, HEADERS).read | |
puts res |
I never nailed this script 100%. I ended up using an automation testing tool(watir-webdriver) to get the same result successfully multiple times. Check out gist https://gist.github.com/1699540
In that example the poll was located at the url speakimge.wordpress.com/2012/01/25/under-the-covers/
I used chrome to figure out the correct radio button and the events to vote and redirect back to initial screen in the loop. I imagine you'll see something similar.
Polldaddy will limit the # of votes you can cast in a time period. I used tor to get around this and set the proxy configuration on line 7. I was able to cast unlimited # of votes after that.
Nice work. I'm not sure how much effort I'll put into this one, since it's just to vote for my favorite burger joint :-) Thanks for the response.
##
Brian Ramsay
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
…On Tuesday, February 21, 2012 at 2:03 PM, Chris Blazek wrote:
I never nailed this script 100%. I ended up using an automation testing tool(watir-webdriver) to get the same result successfully multiple times. Check out gist https://gist.github.com/1699540
In that example the poll was located at the url speakimge.wordpress.com/2012/01/25/under-the-covers/ (http://speakimge.wordpress.com/2012/01/25/under-the-covers/)
I used chrome to figure out the correct radio button and the events to vote and redirect back to initial screen in the loop. I imagine you'll see something similar.
Polldaddy will limit the # of votes you can cast in a time period. I used tor to get around this and set the proxy configuration on line 7. I was able to cast unlimited # of votes after that.
---
Reply to this email directly or view it on GitHub:
https://gist.github.com/1690064
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I constructed URLs that worked when I entered them manually in a browser but not when I tried them in a script - it would just return some headers. I downloaded this and plugged in the numbers and I get the same result. Does this script still work for you?