| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2049 人关注过本帖
标题:VFP发送短信到手机
只看楼主 加入收藏
old_foxer
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2018-3-24
结帖率:50%
收藏
已结贴  问题点数:10 回复次数:1 
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
搜索更多相关主题的帖子: VFP Dim String System Text 
2018-03-27 14:48
吹水佬
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:451
帖 子:10607
专家分:43186
注 册:2014-5-20
收藏
得分:10 
麦讯通的直接参考麦讯通短信接口api应该就可以
2018-03-27 15:39
快速回复:VFP发送短信到手机
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.034445 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved