public static bool SendMsgForAlignDate(string Mobile, string msg) { try { WebClient objWebClient; string sBaseURL; Stream objStreamData; StreamReader objReader; string sResult; objWebClient = new WebClient(); DueAlignRepDAL obj = new DueAlignRepDAL(); var Comp = obj.SelectUserPref(); string UserName = Convert.ToString(DataBinder.Eval(Comp[0], "UserName")); string Password = Convert.ToString(DataBinder.Eval(Comp[0], "Password")); string SenderID = Convert.ToString(DataBinder.Eval(Comp[0], "SenderID")); string ProfileID = Convert.ToString(DataBinder.Eval(Comp[0], "ProfileID")); string AuthType = Convert.ToString(DataBinder.Eval(Comp[0], "AuthType")); string AuthKey = Convert.ToString(DataBinder.Eval(Comp[0], "AuthKey")); sBaseURL = "http://globesms.in/sendhttp.php?user="******"&password="******"&authkey=" + AuthKey + "&type=" + AuthType + "&mobiles=91" + Mobile + "&message=" + HttpUtility.UrlEncode(msg) + "&sender=" + SenderID + "&route=1"; objStreamData = objWebClient.OpenRead(sBaseURL); objReader = new StreamReader(objStreamData); sResult = objReader.ReadToEnd(); objStreamData.Close(); objReader.Close(); return(true); } catch (Exception ex) { return(false); } }
public bool SendSMS(string Mobile, string msg) { if (Mobile != String.Empty && msg != String.Empty) { try { WebClient objWebClient; string sBaseURL; Stream objStreamData; StreamReader objReader; string sResult; objWebClient = new WebClient(); DueAlignRepDAL obj = new DueAlignRepDAL(); var Comp = obj.SelectUserPref(); string UserName = Convert.ToString(DataBinder.Eval(Comp[0], "UserName")); string Password = Convert.ToString(DataBinder.Eval(Comp[0], "Password")); string SenderID = Convert.ToString(DataBinder.Eval(Comp[0], "SenderID")); string ProfileID = Convert.ToString(DataBinder.Eval(Comp[0], "ProfileID")); string AuthType = Convert.ToString(DataBinder.Eval(Comp[0], "AuthType")); string AuthKey = Convert.ToString(DataBinder.Eval(Comp[0], "AuthKey")); //string UserName = "******"; //string Password = "******";//This may vary api to api. like ite may be password, secrate key, hash etc //string SenderID = "Cogxim"; sBaseURL = "http://globesms.in/sendhttp.php?user="******"&password="******"&authkey=" + AuthKey + "&type=" + AuthType + "&mobiles=91" + Mobile + "&message=" + HttpUtility.UrlEncode(msg) + "&sender=" + SenderID + "&route=1"; objStreamData = objWebClient.OpenRead(sBaseURL); objReader = new StreamReader(objStreamData); sResult = objReader.ReadToEnd(); objStreamData.Close(); objReader.Close(); return(true); } catch (Exception ex) { return(false); } } else { return(false); } }