1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
/*Envoi du résultat par MC Tel*/
//http://www.worldofasp.net/tut/WebRequest/Working_with_HttpWebRequest_and_HttpWebResponse_in_ASPNET_114.aspx
// Create a new WebRequest Object to the mentioned URL.
string strSMSMsg = "SITM, dernière lecture = " + sngValeur + " " + strUnite;
Uri oUri = new Uri("http://smsgateway.mctel.fr/cgi-bin/sendsms.cgi");
//http://www.smsfax.fr/pdf/Manuel%20Interface%20HTTP%20HTML%20VideoSMS.pdf
string strData = "";
strData += "Command=sendsms";
strData += "&Version=1.0";
strData += "&UserId=XXXXXXXXX";
strData += "&Password=xxxxxxx";
strData += "&TestMode=0";
strData += "&CompanyId=YYYYYYYY";
strData += "&CompanyPwd=yyyyyyyy";
strData += "&DestNum=" + Server.UrlEncode(strTelPatient);
strData += "&MsgContent=" + Server.UrlEncode(strSMSMsg);
strData += "&MsgType=S";
strData += "&ContentType=TEXT";
strData += "&Encoding=ISO8859-1";
strData += "&OptDeferred=0";
strData += "&OptDefDate=";
strData += "&OptDefTime=";
strData += "&OptExpire=";
strData += "&OptExpiryDate=";
strData += "&OptOptExpiryTime=";
strData += "&OptNotifOnSuccess=1";
strData += "&OptNotifOnError=1";
strData += "&OptNotifType=EMAIL";
strData += "&OptNotifAddress=" + Server.UrlEncode("zzzzz@zzzz.zzz");
strData += "&OptFlash=0";
strData += "&OptReplace=0";
strData += "&PrivateData=" + Server.UrlEncode("\"--------\"");
strData += "&PrivateReference=" + Server.UrlEncode("\"----\"");
strData += "&Originator=mctel";
strData += "&Udhi=0";
strData += "&ReplyEnabled=0";
strData += "&Priority=0";
strData += "&Sessionid=";
strData += "&Sessionstate=";
if (oUri.Scheme == Uri.UriSchemeHttp)
{
HttpWebRequest oHttpWebRequest = (HttpWebRequest)HttpWebRequest.Create(oUri);
oHttpWebRequest.Method = WebRequestMethods.Http.Post;
oHttpWebRequest.ContentLength = strData.Length;
oHttpWebRequest.ContentType = "application/x-www-form-urlencoded";
oHttpWebRequest.Headers.Add("Accept-Charset: utf-8");
oHttpWebRequest.ContentLength = strData.Length;
StreamWriter oStreamWriter = new StreamWriter(oHttpWebRequest.GetRequestStream());
oStreamWriter.Write(strData);
oStreamWriter.Close();
HttpWebResponse oHttpWebResponse = (HttpWebResponse)oHttpWebRequest.GetResponse();
StreamReader oStreamReader = new StreamReader(oHttpWebResponse.GetResponseStream());
string strTmp = oStreamReader.ReadToEnd();
oHttpWebResponse.Close();
} |
Partager