通过互联网将短信从应用程序发送到手机 [英] Send SMS from Application via internet to Mobile Phone

查看:114
本文介绍了通过互联网将短信从应用程序发送到手机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为学校/学院开发了一个应用程序.我集成了模块短信.

如何通过互联网通过批量SMS帐户向手机发送SMS并保存批量帐户配置?

请帮忙........


在此先感谢

I develope a Application for School / College. I integrate a module SMS.

How I send SMS via internet through Bulk SMS Account to Cell Phone and save Bulk Account Confugration ?

please help........


thanks in advance

推荐答案

第一个您需要批量发送短信
2)激活发件人ID并将信用额添加到您的帐户中
3)从您的SMS API提供程序获取HTTP API的详细信息.
4)提供YOur API帐户的用户名和密码.


这是我的从我的SMS API CLASS发送SMS的代码
First YOu Need Bulk SMS Accound
2) Activate the Sender ID and Add Credits into your account
3) Get the Details of HTTP API from your SMS API provider.
4)Provide the UserName and Password of YOur API Account.


Here is My code for sending SMS from My SMS API CLASS
using System.Net;
using System.Text;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
namespace YOurProject.Classes
{
    class SENDSMS
    {
        private WebProxy objProxy1 = null;
        public string SendSMS(string User, string password, string Mobile_Number, string Message)//send parameters as UserName Password mobileNUmb and Message from your application
        {
            string stringpost = null;
            stringpost = "User=" + User + "&passwd=" + password + "&mobilenumber=" + Mobile_Number + "&message=" + Message;
            HttpWebRequest objWebRequest = null;
            HttpWebResponse objWebResponse = null;
            StreamWriter objStreamWriter = null;
            StreamReader objStreamReader = null;
            try
            {
                string stringResult = null;
                objWebRequest = (HttpWebRequest)WebRequest.Create("http://sms.equilux.co.in/WebserviceSMS.aspx");//this is your SMS API provider''s URL
                objWebRequest.Method = "POST";
                if ((objProxy1 != null))
                {
                    objWebRequest.Proxy = objProxy1;
                }
                 objWebRequest.ContentType = "application/x-www-form-urlencoded";
                objStreamWriter = new StreamWriter(objWebRequest.GetRequestStream());
                objStreamWriter.Write(stringpost);
                objStreamWriter.Flush();
                objStreamWriter.Close();
                objWebResponse = (HttpWebResponse)objWebRequest.GetResponse();
                objStreamReader = new StreamReader(objWebResponse.GetResponseStream());
                stringResult = objStreamReader.ReadToEnd();
                objStreamReader.Close();
                return stringResult;
            }
            catch (Exception ex)
            {
                return ex.Message;
            }
            finally
            {
                if ((objStreamWriter != null))
                {
                    objStreamWriter.Close();
                }
                if ((objStreamReader != null))
                {
                    objStreamReader.Close();
                }
                objWebRequest = null;
                objWebResponse = null;
                objProxy1 = null;
            }
        }
 }
}


这篇关于通过互联网将短信从应用程序发送到手机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆