語(yǔ)音驗(yàn)證碼接口文檔 點(diǎn)擊下載
語(yǔ)音驗(yàn)證碼接口接入指南 點(diǎn)擊訪(fǎng)問(wèn)
#接口類(lèi)型:互億無(wú)線(xiàn)語(yǔ)音驗(yàn)證碼接口。
#賬戶(hù)注冊(cè):請(qǐng)通過(guò)該地址開(kāi)通賬戶(hù)https://user.ihuyi.com/new/register.html
#注意事項(xiàng):
#(1)調(diào)試期間,請(qǐng)仔細(xì)閱讀接口文檔;
#(2)請(qǐng)使用 APIID 及 APIKEY來(lái)調(diào)用接口,可在會(huì)員中心獲??;
#(3)該代碼僅供接入互億無(wú)線(xiàn)短信接口參考使用,客戶(hù)可根據(jù)實(shí)際需要自行編寫(xiě);
#!/usr/local/bin/python
#-*- coding:utf-8 -*-
import httplib
import urllib
host = "api.voice.ihuyi.com"
sms_send_uri = "/webservice/voice.php?method=Submit"
#查看用戶(hù)名 登錄用戶(hù)中心->語(yǔ)音驗(yàn)證碼>產(chǎn)品總覽->API接口信息->APIID
account = "用戶(hù)名"
#查看密碼 登錄用戶(hù)中心->語(yǔ)音驗(yàn)證碼>產(chǎn)品總覽->API接口信息->APIKEY
password = "密碼"
def send_sms(text, mobile):
params = urllib.urlencode({'account': account, 'password' : password, 'content': text, 'mobile':mobile,'format':'json' })
headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}
conn = httplib.HTTPConnection(host, port=80, timeout=30)
conn.request("POST", sms_send_uri, params, headers)
response = conn.getresponse()
response_str = response.read()
conn.close()
return response_str
if __name__ == '__main__':
mobile = "138xxxxxxxx"
text = "1125"
print(send_sms(text, mobile))
驗(yàn)證碼已發(fā)送到您的手機(jī),請(qǐng)查收!
輸入驗(yàn)證碼后,點(diǎn)擊“開(kāi)通體驗(yàn)賬戶(hù)”按鈕可立即開(kāi)通體驗(yàn)賬戶(hù)。