hungryhobo14 wrote:So, I can read from the web page to get all the info, but I am having trouble submitting my answer. is this near correct? I am programming in python, on ubuntu
print "the solved string is" + solved
values = {'solution':solved, 'submitbutton':'submit'}
solution = urllib.urlencode(values)
request = urllib2.Request("http://www.hackthissite.org/missions/prog/11", solution)
request.add_header('Referer', 'http://www.hackthissite.org/')
url = urlOpener.open(request)
when I read the returned url, it is just the normal webpage, like I did not submit anything at all. I am new to webpage interaction and programming so any help would be nice
Are you assigning 'request' earlier in your code to open the initial page? If you are, then its opening the initial 'request ='.
If that's the case, just change your submission to something like request2:
- Code: Select all
print "the solved string is" + solved
values = {'solution':solved, 'submitbutton':'submit'}
solution = urllib.urlencode(values)
request2 = urllib2.Request("http://www.hackthissite.org/missions/prog/11", solution)
request2.add_header('Referer', 'http://www.hackthissite.org/')
url = urlOpener.open(request2)
Your first request is to open the webpage to get the info, your second request is to submit your answer, not to get the info from the first request again.