VFP发送短信到手机
这是VB的代码,有哪位大侠帮我转成VFP的代码,不胜感激!Module sendSMS
Sub Main()
Dim content As String = "麦讯通VB示例【麦讯通】"
'POST 方式
Dim sbTemp As System.Text.StringBuilder = New System.Text.StringBuilder()
sbTemp.Append("UserID=812345&account=admin&password=123456&Phones=15988888888&content=" + content + "&SendTime=&SendType=1&PostFixNumber=")
Dim bTemp() As Byte = System.Text.Encoding.GetEncoding("utf-8").GetBytes(sbTemp.ToString())
Dim result As String = PostRequest("http://www., bTemp)
Console.WriteLine(result)
End Sub
'发送HTTP POST请求得结果
Private Function PostRequest(ByVal url As String, ByVal bData() As Byte) As String
Dim strReturn As String = ""
Dim hwRequest As
Dim hwResponse As
Try
hwRequest = (url)
hwRequest.Timeout = 5000
hwRequest.Method = "POST"
hwRequest.ContentType = "application/x-www-form-urlencoded"
hwRequest.ContentLength = bData.Length
Dim smWrite As = hwRequest.GetRequestStream()
smWrite.Write(bData, 0, bData.Length)
smWrite.Close()
hwResponse = hwRequest.GetResponse()
Dim srReader As = New (hwResponse.GetResponseStream(), System.Text.Encoding.ASCII)
strReturn = srReader.ReadToEnd()
srReader.Close()
hwResponse.Close()
Catch