https and POST method

Lorenzo Stella lorestar at gmail.com
Thu Apr 10 10:30:42 EDT 2008


Hi all,
I'm trying to write a simple script for sending sms via vyke... I have
to make a https
connection and pass some data with the POST method, like this perl
script does:

http://www.nutella.org/vyke.sms.txt

I tried to make the same, but it simply doesn't work! Any request
gives a 200 OK result... This is my code:

datah = {"act": "menulogin", "username": login, "password": passwd,
"menu_login_form": 1}
datas = urllib.urlencode(datah)
conn = httplib.HTTPSConnection("www.vyke.com")
conn.connect()
conn.request("POST", "/merchantsite/login.c?Distributor=MASKINA",
datas)
res = conn.getresponse()
print "login", res.status, res.reason
datah = {"act": "sendSMS", "from": numfrom, "to": numto, "message":
msg, "sms_form": 1}
datas = urllib.urlencode(datah)
conn.request("POST", "/merchantsite/sms.c", datas)
res = conn.getresponse()
print "send", res.status, res.reason
conn.request("GET", "/merchantsite/logout.c?Distributor=MASKINA")
res = conn.getresponse()
print "logout", res.status, res.reason
conn.close()

I don't know what to do! :-(



More information about the Python-list mailing list