Over a million developers have joined DZone.

S60 Http Post Python

·
From (http://www.python.org/doc/current/lib/httplib-examples.html)

==
import httplib, urllib

# replace with whatever you want POSTed...
gps_coords = urllib.urlencode({'param_1': 'value_1', 'param_2': 'value_2'})

# form contents
headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}

conn = httplib.HTTPConnection("location-server.com:80")
conn.request("POST", "/cgi-bin/collect_loc", gps_coords, headers)
response = conn.getresponse()
data = response.read()
conn.close()
==

Both httplib and urllib are shipped with PyS60. Of course, you will have to create the CGI script separately.

Cheers,
Sandeep
http://sandeep.weblogs.us/
Topics:

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}