#!/usr/bin/env python
#coding=utf-8
import httplib, urllib
st = u'您的注册验证码为8268,该验证码10分钟内有效。如非本人操作请忽略此短信!【浪驰软件】'
st = st.encode('gb2312')
httpClient = None
try:
params = urllib.urlencode({'UserID': '999999',
'Account': 'Lanz2016',
'Password': '735FF0028B7831D2783DD7EE98E3095DB94A1D64',
'Content': st,
'Phones': '11111111111',
'ReturnXJ': '1'})
headers = {"Content-type": "application/x-www-form-urlencoded",
"Accept": "text/plain"}
httpClient = httplib.HTTPConnection("域名", 80, timeout=30)
httpClient.request("POST", "/LANZGateway/DirectSendSMSs.asp", params, headers)
response = httpClient.getresponse()
#print response.status
#print response.reason
print response.read()
#print response.getheaders() #获取头信息
except Exception, e:
print e
finally:
if httpClient:
httpClient.close()
|
XML: <?xml version="1.0" encoding="GB2312"?> <LANZ_ROOT> <ErrorNum>0</ErrorNum> <JobID>2321313130</JobID> <PhonesSend>98</PhonesSend> <ErrPhones>13855556666;13611112222</ErrPhones> <DeductionSMSs>1000</DeductionSMSs> </LANZ_ROOT> JSON: { "LANZ_ROOT": { "ErrorNum": "0", "JobID": "2321313130", "PhonesSend": "98", "ErrPhones": "13855556666;13611112222", "DeductionSMSs": "1000" } }
|