Exemple #1
2
        /// <summary>
        /// ��ȡԶ��ҳ���HTML���룡
        /// </summary>
        /// <param name="ls_Url"></param>
        /// <param name="charset"></param>
        /// <returns></returns>
        public static string GetRequestText(string ls_Url, string charset)
        {
            MSXML2.XMLHTTP lcom_xmlhttp = new MSXML2.XMLHTTP();
            lcom_xmlhttp.open("GET", ls_Url, false, null, null);
            lcom_xmlhttp.send("");

            //MSXML2.XMLDocument lcom_xmldoc = new MSXML2.XMLDocument();
            Byte[] lb_res = (Byte[])lcom_xmlhttp.responseBody;

            return System.Text.Encoding.GetEncoding(charset).GetString(lb_res).Trim();
        }
Exemple #2
1
 private static string getContent(string url, string charset)
 {
     if (url.Substring(0, 2) == "//")
         url = "http:" + url;
     if(charset=="")
         charset="iso-8859-1";
     MSXML2.XMLHTTP xmlHttp = new MSXML2.XMLHTTP();
     xmlHttp.open("GET", url,false,null,null);
     xmlHttp.setRequestHeader("Content-type", "text/xml;charset="+charset);
     xmlHttp.send("");
     byte[] b = (byte[]) xmlHttp.responseBody;
     return Encoding.GetEncoding(charset).GetString(b).Trim();
 }
Exemple #3
0
        public string DataDetail(string numbersent, string bodysent, string lang, string AGRCODE)
        {
            string strResult = null;
            string str       = null;

            if (lang == "TH")
            {
                str = "TRANSID=BULK&CMD=SENDMSG&FROM=66899264547&TO=" + numbersent + "&REPORT=N&CHARGE=N&CODE=KTBLeasing_BulkSMS&CTYPE=LUNICODE&CONTENT=" + String2Unicode(bodysent).ToUpper() + "";
            }
            else
            {
                str = "TRANSID=BULK&CMD=SENDMSG&FROM=66899264547&TO=" + numbersent + "&REPORT=N&CHARGE=N&CODE=KTBLeasing_BulkSMS&CTYPE=LTEXT&CONTENT=" + bodysent + "";
            }

            string url = null;

            //url = "http://http://corpsmsweb.dtac.co.th/servlet/com.iess.socket.SmsCorplink";
            //ConfigurationManager.AppSettings["AISURL"];
            url = Settings.Default.DTACURL;

            MSXML2.XMLHTTP xmlRequest = new MSXML2.XMLHTTP();
            xmlRequest.open("post", url);
            xmlRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            xmlRequest.setRequestHeader("charset", "utf-8");
            xmlRequest.setRequestHeader("Content-Length", Convert.ToString(str.Length));
            try
            {
                xmlRequest.setRequestHeader("Connection", "close");
                xmlRequest.send(str);
                strResult = "Send SMS Complete ";
            }
            catch (Exception ex)
            {
                strResult = "Error:" + ex.Message.ToString();
            }

            return(strResult);
        }
Exemple #4
0
        //印刷情報を取得する
        public bool GetFcwInfo(SHDocVw.InternetExplorerMedium cIe, string flName)
        {
            try
            {
                string Action;
                string fcw_formfile = "";
                string fcw_datafile = "";
                string url1         = "";
                string url2         = "";

                url2 = "";
                mshtml.HTMLFormElement form;
                mshtml.HTMLDocument    doc;
                doc = (mshtml.HTMLDocument)cIe.Document;
                mshtml.HTMLDocument tmdoc;
                tmdoc = (mshtml.HTMLDocument)doc.body.document;
                form  = (mshtml.HTMLFormElement)tmdoc.forms.item(0);
                mshtml.IHTMLElementCollection forms;
                forms  = (mshtml.IHTMLElementCollection)tmdoc.forms;
                form   = (mshtml.HTMLFormElement)forms.item(null, 0);
                Action = System.Convert.ToString(form.action);

                if (string.IsNullOrEmpty(Action))
                {
                    return(false);
                }

                mshtml.HTMLInputElement hid_fcw_formfile = default(mshtml.HTMLInputElement);
                hid_fcw_formfile = (mshtml.HTMLInputElement)(((mshtml.HTMLDocument)form.document).getElementsByName("fcw-formfile").item(0));
                fcw_formfile     = System.Convert.ToString(hid_fcw_formfile.value);

                mshtml.HTMLInputElement hid_fcw_datafile = default(mshtml.HTMLInputElement);
                hid_fcw_datafile = (mshtml.HTMLInputElement)(((mshtml.HTMLDocument)form.document).getElementsByName("fcw-datafile").item(0));
                fcw_datafile     = System.Convert.ToString(hid_fcw_datafile.value);

                url1 = form.action + "?fcw-driver=FCPC&fcw-formdownload=yes&fcw-newsession=yes&fcw-destination=client&fcw-overlay=3&fcw-endsession=yes&fcw-formfile=" + fcw_formfile + "&fcw-datafile=" + fcw_datafile;

                //Print 画面の情報取得
                object         bodyStr;
                string         bodyTxt   = "";
                MSXML2.XMLHTTP Retrieval = new MSXML2.XMLHTTP();
                Retrieval.open("Get", url1, false, "", "");
                Retrieval.send();
                bodyStr   = Retrieval.responseBody;
                bodyTxt   = System.Convert.ToString(Retrieval.responseText);
                Retrieval = null;

                //帳票のURL取得
                System.Text.RegularExpressions.Regex           reg = new System.Text.RegularExpressions.Regex("src=\"(?<src>[^\"]*)\"");
                System.Text.RegularExpressions.MatchCollection mc  = reg.Matches(bodyTxt);
                foreach (System.Text.RegularExpressions.Match m in mc)
                {
                    url2 = System.Convert.ToString(m.Value);
                }
                url2 = System.Convert.ToString(url2.Replace("src", "").Replace("\"", "").Replace("=http", "http"));
                reg  = null;

                if (System.IO.File.Exists(flName))
                {
                    FileSystem.Rename(flName.Replace(".csv", ".pdf"), flName.Replace(".csv", "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".bk.pdf"));
                }

                //帳票作成
                GetRemoteFiels(url2, flName.Replace(".csv", ".pdf"));

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }