語(yǔ)音通知接口文檔 點(diǎn)擊下載
語(yǔ)音通知接口接入指南 點(diǎn)擊訪問(wèn)
#接口類型:互億無(wú)線語(yǔ)音通知接口。
#賬戶注冊(cè):請(qǐng)通過(guò)該地址開(kāi)通賬戶https://user.ihuyi.com/new/register.html
#注意事項(xiàng):
#(1)調(diào)試期間,請(qǐng)仔細(xì)閱讀接口文檔;
#(2)請(qǐng)使用APIID(查看APIID請(qǐng)登錄用戶中心->語(yǔ)音通知->帳戶及簽名設(shè)置->APIID)及 APIkey來(lái)調(diào)用接口
#(3)該代碼僅供接入互億無(wú)線語(yǔ)音通知接口參考使用,客戶可根據(jù)實(shí)際需要自行編寫(xiě);
#!/usr/local/bin/python
#-*- coding:utf-8 -*-
import httplib
import urllib
host = "api.vm.ihuyi.com"
sms_send_uri = "/webservice/voice.php?method=Submit"
#//用戶名是登錄用戶中心->語(yǔ)音通知->帳戶及簽名設(shè)置->APIID
account = "用戶名"
#密碼 查看密碼請(qǐng)登錄用戶中心->語(yǔ)音通知->帳戶及簽名設(shè)置->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 = "您的訂單號(hào)是:0648。已由順風(fēng)快遞發(fā)出,請(qǐng)注意查收。"
print(send_sms(text, mobile))
驗(yàn)證碼已發(fā)送到您的手機(jī),請(qǐng)查收!
輸入驗(yàn)證碼后,點(diǎn)擊“開(kāi)通體驗(yàn)賬戶”按鈕可立即開(kāi)通體驗(yàn)賬戶。