Hi all, from python I post data to a webpage using urllib and can print that content. See code below. But now i am wondering how to trace sessions? it is needed for a multiplayer game, connected to a webserver. How do i trace a PHP-session? I suppose i have to save a cookie with the sessionID from the webserver? Is this possible with Python? Are their other ways to keep control over which players sends the gamedata?
Secondly, can i handle JSON values? I know how to create them serverside, but how do i handle that response in python? Thank you very much for any answer! Code: import urllib.request import urllib.parse user = 'user' pw = 'password' login_url = 'http://www.xxxxxxxx.nl/test/index.php' data = urllib.parse.urlencode({'user': user, 'pw': pw}) data = data.encode('utf-8') # adding charset parameter to the Content-Type header. request = urllib.request.Request(login_url) request.add_header("Content-Type","application/x-www-form-urlencoded;charset=utf-8") f = urllib.request.urlopen(request, data) print(f.read().decode('utf-8')) -- http://mail.python.org/mailman/listinfo/python-list