SMS Send in MVC and C#
Step1: Create account at http://api.textlocal.in and use account details at code
Appurl.cs
public static string SMSUrl = "http://api.textlocal.in/send/";
public static string SMSAccount = "test@gmail.com";
public static string SMSName = "TEST";
public static string SMSAPI = "SMSAPI Keys";
public static string SMSReg = "Hi!";
SMSSend.cs
using DAL;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
public static String SMS(string msg, string Number)
{
String message = HttpUtility.UrlEncode(msg);
using (var wb = new WebClient())
{
byte[] response = wb.UploadValues(AppUrls.SMSUrl, new NameValueCollection()
{
{"username" , AppUrls.SMSAccount},
{"hash" , AppUrls.SMSAPI},
{"numbers" , Number},
{"message" , message},
{"sender" , AppUrls.SMSName}
});
string res = System.Text.Encoding.UTF8.GetString(response);
return res;
}
}
Reg.cs
SMSSend.SMS(strVcode + AppUrls.SMSReg, "1234567890");
OR
Step1: Create account at http://api.mVaayoo.com/ and use account details at code
Reg.cs
string strUrl = "http://api.mVaayoo.com/mvaayooapi/MessageCompose?user=Test@gmail.com:Test1234&senderID=TEST SMS&receipientno=" + UserPhone.ToString() + "&dcs=0&msgtxt=Hi&state=4";
WebRequest request = HttpWebRequest.Create(strUrl);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream s = (Stream)response.GetResponseStream();
StreamReader readStream = new StreamReader(s);
string dataString = readStream.ReadToEnd();
response.Close();
s.Close();
readStream.Close();
Step1: Create account at http://api.textlocal.in and use account details at code
Appurl.cs
public static string SMSUrl = "http://api.textlocal.in/send/";
public static string SMSAccount = "test@gmail.com";
public static string SMSName = "TEST";
public static string SMSAPI = "SMSAPI Keys";
public static string SMSReg = "Hi!";
SMSSend.cs
using DAL;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
public static String SMS(string msg, string Number)
{
String message = HttpUtility.UrlEncode(msg);
using (var wb = new WebClient())
{
byte[] response = wb.UploadValues(AppUrls.SMSUrl, new NameValueCollection()
{
{"username" , AppUrls.SMSAccount},
{"hash" , AppUrls.SMSAPI},
{"numbers" , Number},
{"message" , message},
{"sender" , AppUrls.SMSName}
});
string res = System.Text.Encoding.UTF8.GetString(response);
return res;
}
}
Reg.cs
SMSSend.SMS(strVcode + AppUrls.SMSReg, "1234567890");
OR
Step1: Create account at http://api.mVaayoo.com/ and use account details at code
Reg.cs
string strUrl = "http://api.mVaayoo.com/mvaayooapi/MessageCompose?user=Test@gmail.com:Test1234&senderID=TEST SMS&receipientno=" + UserPhone.ToString() + "&dcs=0&msgtxt=Hi&state=4";
WebRequest request = HttpWebRequest.Create(strUrl);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream s = (Stream)response.GetResponseStream();
StreamReader readStream = new StreamReader(s);
string dataString = readStream.ReadToEnd();
response.Close();
s.Close();
readStream.Close();
No comments:
Post a Comment