通过验证码短信http调用接口,您可以很快速的在网站或者app中集成手机号验证功能,该源码只是核心代码,具体可以根据您的实际需求进行扩展。
该DEMO是VB通过http调用验证码短信接口源码;
VERSION 5.00Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "Mswinsck.OCX"Begin VB.Form Form1 Caption = "Form1" ClIEntHeight = 4740 ClIEntleft = 120 ClIEnttop = 450 ClIEntWIDth = 5940 linktopic = "Form1" ScaleHeight = 4740 ScaleWIDth = 5940 StartUpposition = 2 '屏幕中心 Begin MSWinsocklib.Winsock Winsock1 left = 4920 top = 4200 _ExtentX = 741 _ExtentY = 741 _Version = 393216 End Begin VB.TextBox Text4 Height = 270 left = 360 TabIndex = 4 Text = $"Form1.frx":0000 top = 1200 WIDth = 5415 End Begin VB.TextBox Text3 Height = 270 left = 360 TabIndex = 3 Text = "手机号码" top = 840 WIDth = 2775 End Begin VB.TextBox Text2 Height = 270 left = 360 TabIndex = 2 Text = "密码" top = 480 WIDth = 2775 End Begin VB.TextBox Text1 Height = 270 left = 360 TabIndex = 1 Text = "用户名" top = 120 WIDth = 2775 End Begin VB.Commandbutton Command1 Caption = "提 交" Height = 495 left = 3720 TabIndex = 0 top = 240 WIDth = 1215 End Begin VB.Label Label2 autoSize = -1 'True Caption = "Label2" Height = 180 left = 360 TabIndex = 6 top = 2160 Visible = 0 'False WIDth = 540 End Begin VB.Label Label1 autoSize = -1 'True Caption = "状态" Height = 180 left = 360 TabIndex = 5 top = 1920 WIDth = 360 EndEndAttribute VB_name = "Form1"Attribute VB_GlobalnameSpace = FalseAttribute VB_Creatable = FalseAttribute VB_PredeclaredID = TrueAttribute VB_Exposed = FalsePrivate Sub Form_Load() Winsock1.Protocol = sckTCPProtocol Winsock1.RemoteHost = "106.ihuyi.com" Winsock1.RemotePort = 80 Winsock1.Connect DoEvents If Winsock1.State <> 7 Then Label1.Caption = "状态:服务器连接成功" & Chr(13) Text1.Text = "用户名" Text2.Text = "密码" Text3.Text = "手机号码&Coding=GBK" '&Coding=GBK不要删除 End SubPrivate 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=" + Text1.Text + "&password=" + Text2.Text + "&mobile=" + Text3.Text + "&content=" + Text4.Text Dim Ai() As Byte Ai = StrConv(strWebPage,vbFromUnicode) CLength = UBound(Ai) + 1 Str = "POST /webservice/sms.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: 106.ihuyi.com" + vbCrLf Str = Str + "Accept-Language: zh-CN,*" + vbCrLf Str = Str + "Accept-EnCoding: gzip,deflate" & vbCrLf Str = Str & "Content-Length: " & Len(PostData) & vbCrLf & vbCrLf Str = Str & PostData & vbCrLf 'MsgBox str strWebPage = "http://106.ihuyi.com//webservice/sms.PHP?method=submit&account=" + Text1.Text + "&password=" + Text2.Text + "&mobile=" + Text3.Text + "&content=" + Text4.Text strCommand = "GET " + strWebPage + " http/1.0" + vbCrLf strCommand = strCommand + vbCrLf If Winsock1.State <> 7 Then Winsock1.Protocol = sckTCPProtocol Winsock1.RemoteHost = "106.ihuyi.com" Winsock1.RemotePort = 80 Winsock1.Connect DoEvents Winsock1.SendData Str Else Winsock1.SendData strCommand End If 'Label1.Caption = "状态:" & strState & Chr(13) & strCommand & Chr(13) End SubPrivate Sub Winsock1_DataArrival(ByVal bytesTotal As Long)Dim rec() As ByteWinsock1.GetData rec,vbString'MsgBox Utf8ToUnicode(Right(rec,150))Label2.Visible = TrueLabel2.Caption = Utf8ToUnicode(rec)Winsock1.CloseEnd Sub自助申请帐户地址: http://www.ihuyi.com/product.php
完整接口文件地址: http://www.ihuyi.com/upload/file/cu-fa-jie-kou.rar 总结
以上是内存溢出为你收集整理的VB通过http调用验证码短信接口源码全部内容,希望文章能够帮你解决VB通过http调用验证码短信接口源码所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)