互億無線 · 文檔中心

語音驗證碼 - 代碼示例


VB6對接語音驗證碼接口DEMO示例
本文為您提供了VB6語言版本的語音驗證碼接口對接DEMO示例

語音驗證碼接口文檔 點(diǎn)擊下載

語音驗證碼接口接入指南 點(diǎn)擊訪問

Private Sub Form_Load()
    Winsock1.Protocol = sckTCPProtocol
    Winsock1.RemoteHost = "api.voice.ihuyi.com"
    Winsock1.RemotePort = 80
    Winsock1.Connect
    DoEvents
         
    If Winsock1.State <> 7 Then Label1.Caption = "狀態(tài):服務(wù)器連接成功" & Chr(13)
         
    Text1.Text = "用戶名"
    Text2.Text = "密碼為APIKEY(可以登錄用戶中心查看)"
    Text3.Text = "手機(jī)號碼"
    Text4.Text = "1125"
         
End Sub
Private Sub Command1_Click()
 
    On Error Resume Next
 
    Dim PostData As String
    Dim Str As String
      
    Dim strWebPage As String
    Dim strCommand As String
         
    PostData = "account=" + toUTF8(Text1.Text) + "&password=" + toUTF8(Text2.Text) + "&mobile=" + toUTF8(Text3.Text) + "&content=" + toUTF8(Text4.Text)
     
    Dim Ai() As Byte
    Ai = StrConv(strWebPage, vbFromUnicode)
    CLength = UBound(Ai) + 1
    Str = "POST /webservice/voice.php?method=Submit HTTP/1.1" + vbCrLf
    Str = Str + "Accept: */*" + vbCrLf
    Str = Str + "Content-Type: application/x-www-form-urlencoded" + vbCrLf
    Str = Str + "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; Maxthon; .NET CLR 1.1.4322)" & vbCrLf
    Str = Str + "Language: zh-CN, zh, *" + vbCrLf
    Str = Str + "Connection: Keep-Alive" + vbCrLf
    Str = Str + "Host: api.voice.ihuyi.com" + vbCrLf
    Str = Str + "Accept-Language: zh-CN, zh, *" + vbCrLf
    Str = Str + "Accept-Encoding: gzip, deflate" & vbCrLf
    Str = Str & "Content-Length: " & Len(PostData) & vbCrLf & vbCrLf
    Str = Str & PostData & vbCrLf
 
 
     
    strWebPage = "http://api.voice.ihuyi.com/webservice/voice.php?method=Submit&account=" + toUTF8(Text1.Text) + "&password=" + toUTF8(Text2.Text) + "&mobile=" + toUTF8(Text3.Text) + "&content=" + toUTF8(Text4.Text)
    strCommand = "GET " + strWebPage + " HTTP/1.0" + vbCrLf
    strCommand = strCommand + vbCrLf
     
    'MsgBox strWebPage
     
    If Winsock1.State <> 7 Then
        Winsock1.Protocol = sckTCPProtocol
        Winsock1.RemoteHost = "api.voice.ihuyi.com"
        Winsock1.RemotePort = 80
        Winsock1.Connect
        DoEvents
        Winsock1.SendData Str
    Else
        Winsock1.SendData strCommand
    End If
     
 
 
    'Label1.Caption = "狀態(tài):" & strState & Chr(13) & strCommand & Chr(13)
     
End Sub
 
 
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim rec() As Byte
Winsock1.GetData rec, vbString
'MsgBox Utf8ToUnicode(Right(rec, 150))
 
Label2.Visible = True
Label2.Caption = Utf8ToUnicode(rec)
 
Winsock1.Close
End Sub


語音驗證碼接口
語音驗證碼+短信驗證碼雙重保證;
無需額外開發(fā),在平臺直接配置即可使用。
24小時發(fā)送 失敗自動重呼 企業(yè)獨(dú)享外呼號碼 自助配置語音+短信驗證碼
自助開通語音驗證碼免費(fèi)試用賬戶

現(xiàn)在注冊,即享新用戶禮包!

在線咨詢
電話咨詢

服務(wù)熱線:

4008 808 898

服務(wù)熱線(工作時間):

4008 808 898

業(yè)務(wù)咨詢(非工作時間):

售后咨詢(非工作時間):

驗證碼已發(fā)送到您的手機(jī),請查收!

輸入驗證碼后,點(diǎn)擊“開通體驗賬戶”按鈕可立即開通體驗賬戶。

收不到短信驗證碼?
互億無線不提供接碼服務(wù),接碼用戶請勿點(diǎn)擊開通按鈕。
×