在foxtable中添加引用system.web.dll
将下面的代码复制到foxtable的全局代码
Public Class DotNet
Public retValue As String = ""
Dim WReq As System.Net.WebRequest
Dim WResp As System.Net.WebResponse
Dim sr As System.IO.StreamReader
Public Function GetResponseA(ByVal corpID As String, ByVal loginName As String, ByVal send_No As String, ByVal words As String) As String
'
' 创建将 URI 传递给 .Create() 方法的 WebRequest 对象
' 并通过调用 .GetResponse() 从服务器获取响应;
' 当涉及进展时,我们会仔细研究这样做的原因
Dim _corpID As String = corpID
Dim _LoginName As String = loginName
Dim _send_no As String = send_No
Dim _words As String = words
'U
Dim _YHURL As String = "http://web.mobset.com/SDK/Sms_Send.asp?CorpID=" & _corpID & "&LoginName=" & _LoginName & "&send_no=" & _send_no & "&msg=" & HttpUtility.UrlEncode(_words, System.Text.Encoding.GetEncoding("GB2312"))
WReq = System.Net.WebRequest.Create(_YHURL)
WResp = WReq.GetResponse()
''从服务器获取可读的流——将数据编写为 UTF7 码以写入到控制台
sr = New System.IO.StreamReader(WResp.GetResponseStream(), System.Text.Encoding.UTF7)
retValue = sr.ReadToEnd()
sr.Close()
Return retValue '返回值。。。
End Function
Public Sub GetReceive(ByVal corpID As String, ByVal loginName As String, ByRef sendNo() As String, ByRef recNum() As String, ByRef recTime() As String, ByRef content() As String)
' = "http://web.mobset.com/SDK/Sms_Status.asp?SmsID="&request("SmsID")
Dim aDocument As New System.Xml.XmlDocument
Dim _YHURL As String = "http://web.mobset.com/SDK/Sms_Recv.asp?CorpID=" & corpID & "&LoginName=" & loginName & "&XML=1"
WReq = System.Net.WebRequest.Create(_YHURL)
WResp = WReq.GetResponse()
''从服务器获取可读的流——将数据编写为 UTF7 码以写入到控制台
sr = New System.IO.StreamReader(WResp.GetResponseStream(), System.Text.Encoding.UTF7)
'返回剩余短信数量。。
retValue = sr.ReadToEnd()
sr.Close()
aDocument.LoadXml(retValue)
Dim ii, kk As Integer
Dim iCount As Integer = -1
For ii = 0 To aDocument.ChildNodes.Count - 1
Dim xmlNode As System.Xml.XmlNode = aDocument.ChildNodes(ii)
If xmlNode.NodeType = System.Xml.XmlNodeType.Element Then
For kk = 0 To xmlNode.ChildNodes.Count - 1
Dim xmlNode2 As System.Xml.XmlNode = xmlNode.ChildNodes(kk)
If xmlNode2.ChildNodes.Count >= 4 Then
iCount += 1
End If
Next
End If
Next
ReDim sendNo(iCount)
ReDim recNum(iCount)
ReDim recTime(iCount)
ReDim content(iCount)
If iCount = -1 Then
Exit Sub
End If
Dim jj As Integer = 0
For ii = 0 To aDocument.ChildNodes.Count - 1
Dim xmlNode As System.Xml.XmlNode = aDocument.ChildNodes(ii)
If Not xmlNode Is Nothing Then
If xmlNode.NodeType = System.Xml.XmlNodeType.Element Then
For kk = 0 To xmlNode.ChildNodes.Count - 1
Dim xmlNode2 As System.Xml.XmlNode = xmlNode.ChildNodes(kk)
If xmlNode2.ChildNodes.Count >= 3 Then
sendNo(jj) = xmlNode2.ChildNodes(0).ChildNodes(0).Value
recNum(jj) = CInt(Val(xmlNode2.ChildNodes(1).ChildNodes(0).Value))
recTime(jj) = xmlNode2.ChildNodes(2).ChildNodes(0).Value
',1081471662,1081471663,1081471664,1081471665
content(jj) = System.Web.HttpUtility.UrlDecode(xmlNode2.ChildNodes(3).ChildNodes(0).Value)
jj += 1
End If
Next
End If
End If
Next
End Sub
Public Sub GetStatus(ByVal msgID As String)
Dim _YHURL As String = "http://web.mobset.com/SDK/Sms_Status.asp?SmsID=" & msgID
WReq = System.Net.WebRequest.Create(_YHURL)
WResp = WReq.GetResponse()
''从服务器获取可读的流——将数据编写为 UTF7 码以写入到控制台
sr = New System.IO.StreamReader(WResp.GetResponseStream(), System.Text.Encoding.UTF7)
retValue = sr.ReadToEnd()
sr.Close()
End Sub
Public Sub GetLeftMsg(ByVal corpID As String, ByVal loginName As String)
Dim _YHURL As String = "http://web.mobset.com/SDK/Sms_KYSms.asp?CorpID=" & corpID & "&LoginName=" & loginName
WReq = System.Net.WebRequest.Create(_YHURL)
WResp = WReq.GetResponse()
''从服务器获取可读的流——将数据编写为 UTF7 码以写入到控制台
sr = New System.IO.StreamReader(WResp.GetResponseStream(), System.Text.Encoding.UTF7)
'返回剩余短信数量。。
retValue = sr.ReadToEnd()
sr.Close()
End Sub
End Class