Saturday, January 14, 2012

How to submit(Post) a webfrom from python/IronPython

In this post,I am going to show you how to post data from python to a webfrom from python.
import urllib.parse
import urllib.request
url='http://www.dijksterhuis.org/test/post.php'
values={'keyword':'Void',
        'data':'aspdotnetcodebook'
        }
data=urllib.parse.urlencode(values)
binary_data = data.encode('utf-8')
req=urllib.request.Request(url,binary_data)
response=urllib.request.urlopen(req)
the_page=response.read()
print (the_page)