Answer:
'submit button'
What I've used:
Expand|Select|Wrap|Line Numbers
- import urllib2
- import urllib
- import re
- url='http://website.here'
- strSession='cookie.info.here'
- dicHeaders={'COOKIE':strSession}
- req=urllib2.Request(url, None, dicHeaders)
- f=urllib2.urlopen(req)
- strContext=f.read()
- out=open("data.txt","w")
- out.write(strContext)
- out.close()
- infile=open("data.txt","r")
- *re code here*
- answer=10 # answer varies
- print answer
- password=urllib.urlencode({'solution':answer})
- req2=urllib2.Request(url,password,dicHeaders)
- f2=urllib2.urlopen(req2)
- print f2.read()
Here are the form actions of both pages for comparison. The first is the one that previously worked, the 2nd the new one I'm trying.
************************************************** ******************************************
<form name="submitform" action="/website.here" method="post"><br />
Answer:
<input size="50" name="solution"><br /><br />
<div style="text-align:center">
<input name ="submitbutton" type="submit" value="submit (remaining time: 3 seconds)">
</div>
</form>
************************************************** *******************************************
<form name="submitform" action="/website.here" method="POST"><br />
Answer: <br />
<input size="75" name="solution"><br /><br />
<div style="text-align:center">
<input name ="submitbutton" type="submit" value="Submit (remaining time: 5 seconds)">
</div>
</form>
************************************************** *******************************************
Is there another way for me to get this answer to send?