>>>>> "[email protected]" <[email protected]> (t) wrote:
>t> Hi,
>t> I'm trying to post data to a short test script in php I wrote.
>t> The python code to do the post is
>t> import httplib
>t> #server address
>t> conn = httplib.HTTPConnection("localhost")
headers = {"Content-type": "application/x-www-form-urlencoded",
"Accept": "text/plain"}
>t> #file location
>t> conn.request("POST", "/programming/bots/test.php","&ted=fred")
conn.request("POST", "/programming/bots/test.php", "ted=fred", headers)
>t> r1 = conn.getresponse()
>t> print r1.status, r1.reason
>t> data1 = r1.read()
>t> print data1
>t> conn.close()
>t> print "new ok"
>t> The PHP script is
>t> print"hello <br>";
>t> print $_POST["ted"];
>t> Ted post
--
Piet van Oostrum <[email protected]>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
--
http://mail.python.org/mailman/listinfo/python-list