阅信短信验证码平台最近会从新梳理基于不同语言的短信接口调用代码示例,是为了迎合市面上现在流行的各个语言代码实现,也是为了能够更好的服务满足客户的不同层次的需求。
下面的代码是基于 python 的短信接口调用代码示例模板,客户可拿来直接使用。
#coding=utf-8
import urllib
import urllib2
import time
import hashlib
def md5(str):
import hashlib
m = hashlib.md5()
m.update(str)
returnm.hexdigest()
url = 'http://IP;端口;
timenew= time.strftime("%Y%m%d%H%M%S", time.localtime(time.time()))
pwd = md5('**********'+timenew)
values = {'name':'syncs','pwd':pwd,'content':' [阅信短信平台] 验证码 888888 ,千万不能告诉别人哦。','phone':'13381272353','subid':'','mttime':timenew}
data = urllib.urlencode(values)
req = urllib2.Request(url, data)
response = urllib2.urlopen(req)
the_page = response.read()
print the_page