Hello i have recently learned the basics of python and today i have been playing with urllib. What i intended for this function was for it to connect to my site, fill out the form wich will write to my sites database. I know my php is working properly but i can't get the out put in my data base. Thanks for any input!

def reg():
	P = "P"
	values ={"username":P,   "name":P,   "email":P,"emailtwo":P, "password":P,  "passwordtwo":P}
	data = urllib.urlencode(values)
	user_agent = 'Mozilla/4.0(compatible; MSIE 5.5;WINDOWS NT)'
	headers = {'User-Agent':user_agent}
	url = "http://mysite.hostoi.com/Register.html"
	req = urllib2.Request(url,data,headers)
	resp = urllib2.urlopen(req)
	return resp

You could try record POST requests with http proxy, some like Paros. Try to compare request from your script and request from browser when you fill your form manually.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.