开发者

ASP.NET SMS Gateway API

开发者 https://www.devze.com 2023-04-02 09:45 出处:网络
I purchased a SMS gateway for which they gave me only HTTP and XML API but I need ASP.NET API to work on my project. Can anybody help me how to convert the below API to ASP.NET(c#) API.

I purchased a SMS gateway for which they gave me only HTTP and XML API but I need ASP.NET API to work on my project. Can anybody help me how to convert the below API to ASP.NET(c#) API.

HTTP API

http://indiansms.smsmaker.in/api/sendmsg.php?user=*********&pass=********&sender=Sender ID&phone=Mobile No&text=SMS&priority=Priority&stype=smstype

XML API

$data="<?xml version='1.0' encoding='utf-8'?>
<MESSAGE>
<USERNAME>username</USERNAME>
<PASSWORD>password</PASSWORD>
<TEXT>Hi, this is a test message</TEXT>
<PRIORITY>ndnd</PRIORITY>
<SENDER>S开发者_JAVA技巧enderId</SENDER>
<MSGTYPE>normal</MSGTYPE>
<ADDRESS>*********</ADDRESS>
<ADDRESS>*********</ADDRESS>
</MESSAGE>";

How to convert this API to ASP.NET API.

I know that this question is unqualified to post it here. But I need it immediately.


I have done something similar from an .Net application where we used the http api to send sms. We used the webclient in .net to send messages.

    using (var client = new WebClient())
    {
        client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR1.0.3705;)");
        client.QueryString.Add("user", "username");
        client.QueryString.Add("pass", "password");
        // Add all the parameters you need

        using (Stream stream = client.OpenRead("http://indiansms.smsmaker.in/api/sendmsg.php"))
        {
            // Do something with the response..
        }
    }
0

精彩评论

暂无评论...
验证码 换一张
取 消