You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.4 KiB
40 lines
1.4 KiB
using System.Globalization;
|
|
using System.Net;
|
|
using System.Text;
|
|
using System.Web;
|
|
|
|
namespace CounsellorBL.Helper
|
|
{
|
|
public static class PhoneMessageSenderHelper
|
|
{
|
|
public static string SendPhoneMessage(string i_sAccount, string i_sPass, string i_sMsg, string i_sPhoneNumber, out string o_sServerResult)
|
|
{
|
|
string sMsg = null;
|
|
|
|
using WebClient client = new WebClient();
|
|
|
|
var url = string.Format(CultureInfo.CurrentCulture, "http://api.kotsms.com.tw/kotsmsapi-1.php?username={0}&password={1}&dstaddr={2}&smbody={3}",
|
|
i_sAccount,
|
|
i_sPass,
|
|
i_sPhoneNumber,
|
|
HttpUtility.UrlEncode(i_sMsg, Encoding.GetEncoding(950))
|
|
);
|
|
o_sServerResult = client.DownloadString(url);
|
|
|
|
return sMsg;
|
|
}
|
|
|
|
public static string CheckPhoneMessageResult(string i_sAccount, string i_sPass, string i_kmsgid, out string o_sServerResult)
|
|
{
|
|
string sMsg = null;
|
|
using (WebClient client = new WebClient())
|
|
{
|
|
var url = string.Format(CultureInfo.CurrentCulture, $"https://api.kotsms.com.tw/msgstatus.php?username={i_sAccount}&password={i_sPass}&{i_kmsgid}");
|
|
string sServerResult = client.DownloadString(url);
|
|
|
|
o_sServerResult = sServerResult;
|
|
}
|
|
return sMsg;
|
|
}
|
|
}
|
|
}
|