On the way of learning " handling POST request in php" i tried to make a
simple python http client using httplib2 & urllib module.. what i wanted to
do was submitting username & password field to a php script (which just
echo's the username & password)  & prints the response in python,not in
html/php..

import httplib2
import urllib
url="http://localhost/form_process.php";
body={'username':'xyz','password':'abc'}
h=httplib2.Http()
response,content=h.request(url,'POST',urllib.urlencode(body))
print content

I got the following content:

*<html>
<head><title>Form processing</title></head>
<body>
: </body>
</html>*


instead of:

*<html>
<head><title>Form processing</title></head>
<body>
xyz: abc</body>
</html>*

attachments:
form.php # takes username,password from the user,pass those to
              # form_process.php as GET parameter
form_process.php # echo username,password.

sorry for my long email.

<<attachment: form.php>>

<<attachment: form_process.php>>

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to