예제 #1
0
파일: Form1.cs 프로젝트: respost/CASTool
 private void Check()
 {
     while (true)
     {
         try
         {
             string strurl = this.txtUrl.Text.Trim();
             if (strurl == string.Empty)
             {
                 MessageBox.Show("采集地址不能为空", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 break;
             }
             string       url     = strurl + "?t=" + DateTime.Now.ToString("yyyyMMddHHmmss");
             XMLHTTPClass xmlhttp = new XMLHTTPClass();
             xmlhttp.open("Get", url, false, null, null);
             xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
             xmlhttp.send(null);
             if (xmlhttp.status == 200)
             {
                 this.labStatus.Text = "最後一次執行時間 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
             }
             else
             {
                 this.labStatus.ForeColor = Color.Red;
                 this.labStatus.Text      = "URL执行错误 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
             }
         }
         catch (Exception)
         {
             this.labStatus.ForeColor = Color.Red;
             this.labStatus.Text      = "URL连接失敗 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
         }
         Thread.Sleep(this.speed);
     }
 }
예제 #2
0
파일: XmlHttp.cs 프로젝트: daonidedie/-
        /// <summary>
        /// 使用XMLHTTP 来得到数据 返回 responseText的数据
        /// </summary>
        /// <param name="getxmlurl">请求URL</param>
        public String XMLContent(string getxmlurl)
        {
            string strXdata = "";

            if (getxmlurl != "")
            {
                // xmlhttp類
                XMLHTTPClass xmlhttp = new XMLHTTPClass();
                xmlhttp.open("get", getxmlurl, false, "", "");
                xmlhttp.send(null);
                if (xmlhttp.readyState == 4)
                {
                    //替换数据 使他符合XML
                    strXdata = xmlhttp.responseText;
                }
            }

            return(strXdata);
        }
예제 #3
0
파일: XmlHttp.cs 프로젝트: daonidedie/-
        /// <summary>
        /// 使用XMLHTTP 来得到数据 返回经过处理的 responseText的数据
        /// </summary>
        /// <param name="xmlgetdataurl">请求URL</param>
        public String XmlHttpCont(string xmlgetdataurl)
        {
            string strXdata = "";

            if (xmlgetdataurl != "")
            {
                // xmlhttp類
                XMLHTTPClass xmlhttp = new XMLHTTPClass();
                xmlhttp.open("get", xmlgetdataurl, false, "", "");
                //xmlhttp.open("get", "http://bk.17173.com/ajax/getajaxinfo.php?Start=getAskList&currpage=" + (page + 1) + "&pagesize=20&status=" + status + "&parent=" + url + "&type=3", false, "", "");
                //xmlhttp.open("get", "http://bk.17173.com/ajax/getajaxinfo.php?Start=getAskList&currpage=1&pagesize=20&status=r&parent=20&type=3", false, "", "");
                xmlhttp.send(null);
                if (xmlhttp.readyState == 4)
                {
                    //替换数据 使他符合XML
                    strXdata = XmlTextData(xmlhttp.responseText);
                }
            }

            return(strXdata);
        }
예제 #4
0
 public static string Get_Xml_DataS(string _url, string _user, string _pwd)
 {
     if (_user == null)
     {
         _user = "";
     }
     if (_pwd == null)
     {
         _pwd = "";
     }
     XMLHTTP xmlhttp = new XMLHTTPClass();
     xmlhttp.open("GET", _url, false, _user, _pwd);
     xmlhttp.setRequestHeader("content-type", "text/html; charset=gb2312");
     xmlhttp.send("");
     if (xmlhttp.readyState == 4)
     {
         return xmlhttp.responseText;
     }
     return null;
 }
예제 #5
0
 public static DataSet Get_Xml_DataD(string v_url, string v_user, string v_pwd)
 {
     if (v_user == null)
     {
         v_user = "";
     }
     if (v_pwd == null)
     {
         v_pwd = "";
     }
     DataSet set = new DataSet();
     XMLHTTP xmlhttp = new XMLHTTPClass();
     xmlhttp.open("GET", v_url, false, v_user, v_pwd);
     xmlhttp.setRequestHeader("content-type", "text/html; charset=gb2312");
     xmlhttp.send("");
     if (xmlhttp.readyState == 4)
     {
         MemoryStream stream = new MemoryStream((byte[]) xmlhttp.responseBody);
         set.ReadXml(stream);
         stream.Close();
     }
     return set;
 }
예제 #6
0
 public static DataSet GetXmlData(string Url, string User, string Pwd)
 {
     if (User == null)
     {
         User = "";
     }
     if (Pwd == null)
     {
         Pwd = "";
     }
     DataSet set = new DataSet();
     XMLHTTPClass class2 = new XMLHTTPClass();
     class2.open("post", Url, false, User, Pwd);
     class2.setRequestHeader("content-type", "text/html; charset=gb2312");
     class2.send("");
     if (class2.readyState == 4)
     {
         MemoryStream stream = new MemoryStream((byte[]) class2.responseBody);
         set.ReadXml(stream);
         stream.Close();
     }
     return set;
 }
예제 #7
0
        private void sendSMS(string sendMobilePhone)
        {
            if (sendMobilePhone.Length == 11)
            {
                try
                {
                    string spNumber = string.Empty;

                    switch (sendMobilePhone.Substring(2, 1))
                    {
                    case "0":
                        spNumber = "9002733";
                        break;

                    case "1":
                        spNumber = "9002733";
                        break;

                    case "2":
                        spNumber = "9002733";
                        break;

                    case "3":
                        spNumber = "9002733";
                        break;

                    case "4":
                        spNumber = "9002733";
                        break;

                    case "5":
                        spNumber = "8002733";
                        break;

                    case "6":
                        spNumber = "8002733";
                        break;

                    case "7":
                        spNumber = "8002733";
                        break;

                    case "8":
                        spNumber = "8002733";
                        break;

                    case "9":
                        spNumber = "8002733";
                        break;
                    }

                    string url = "http://202.96.236.81:7783/testDownMsg.asp?"
                                 + "UID=sap&psd=0F3E419C71C500FA1FC8&source=" + spNumber + "&mobile="
                                 + sendMobilePhone + "&message=" + memoEdit_Content.Text;

                    MSXML2.XMLHTTPClass xmlHttp = new MSXML2.XMLHTTPClass();
                    xmlHttp.open("POST", url, false, null, null);
                    xmlHttp.setRequestHeader("Accept-Lauguage", "zh-cn");

                    xmlHttp.send(null);

                    if (xmlHttp.status == 200)
                    {
                        if (xmlHttp.responseText == "0")
                        {
                            MessageBox.Show("短信发送成功!", "成功!",
                                            MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("短信发送失败,请重试!", "出错了!",
                                            MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }
                    }
                    else
                    {
                        MessageBox.Show("短信发送失败,请重试!", "出错了!",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }

            else
            {
                sendMobilePhone = sendMobilePhone.Substring(0, sendMobilePhone.Length - 1);

                string[] sendMobilePhones = sendMobilePhone.Split(new char[] { ',' });

                foreach (string phoneNumber in sendMobilePhones)
                {
                    try
                    {
                        string spNumber = string.Empty;

                        switch (phoneNumber.Substring(2, 1))
                        {
                        case "0":
                            spNumber = "9002733";
                            break;

                        case "1":
                            spNumber = "9002733";
                            break;

                        case "2":
                            spNumber = "9002733";
                            break;

                        case "3":
                            spNumber = "9002733";
                            break;

                        case "4":
                            spNumber = "9002733";
                            break;

                        case "5":
                            spNumber = "8002733";
                            break;

                        case "6":
                            spNumber = "8002733";
                            break;

                        case "7":
                            spNumber = "8002733";
                            break;

                        case "8":
                            spNumber = "8002733";
                            break;

                        case "9":
                            spNumber = "8002733";
                            break;
                        }

                        string url = "http://202.96.236.81:7783/testDownMsg.asp?"
                                     + "UID=sap&psd=0F3E419C71C500FA1FC8&source=" + spNumber + "&mobile="
                                     + phoneNumber + "&message=" + memoEdit_Content.Text;

                        XMLHTTP xmlHttp = new XMLHTTPClass();
                        xmlHttp.open("POST", url, false, null, null);
                        xmlHttp.setRequestHeader("Accept-Lauguage", "zh-cn");

                        xmlHttp.send(null);

                        if (xmlHttp.status == 200)
                        {
                            if (xmlHttp.responseText == "0")
                            {
                            }
                            else
                            {
                                MessageBox.Show("短信发送失败,请重试!", "出错了!",
                                                MessageBoxButtons.OK, MessageBoxIcon.Information);
                                return;
                            }
                        }
                        else
                        {
                            MessageBox.Show("短信发送失败,请重试!", "出错了!",
                                            MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "出错了!",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }

                MessageBox.Show("操作完成!", "完成!",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #8
0
		private void sendSMS(string sendMobilePhone)
		{
			if(sendMobilePhone.Length==11)
			{
				try
				{
					string spNumber = string.Empty;

					switch(sendMobilePhone.Substring(2,1))
					{
						case "0":
							spNumber = "9002733";
							break;
						case "1":
							spNumber = "9002733";
							break;
						case "2":
							spNumber = "9002733";
							break;
						case "3":
							spNumber = "9002733";
							break;
						case "4":
							spNumber = "9002733";
							break;
						case "5":
							spNumber = "8002733";
							break;
						case "6":
							spNumber = "8002733";
							break;
						case "7":
							spNumber = "8002733";
							break;
						case "8":
							spNumber = "8002733";
							break;
						case "9":
							spNumber = "8002733";
							break;
					}

					string url = "http://202.96.236.81:7783/testDownMsg.asp?"
						+"UID=sap&psd=0F3E419C71C500FA1FC8&source="+spNumber+"&mobile="
						+sendMobilePhone+"&message="+memoEdit_Content.Text;

					MSXML2.XMLHTTPClass xmlHttp = new MSXML2.XMLHTTPClass();
					xmlHttp.open("POST" , url , false , null , null  );          
					xmlHttp.setRequestHeader( "Accept-Lauguage" , "zh-cn" );    

					xmlHttp.send( null );          
                                    
					if(xmlHttp.status == 200)
					{
						if(xmlHttp.responseText == "0")
						{

							MessageBox.Show("短信发送成功!","成功!",
								MessageBoxButtons.OK,MessageBoxIcon.Information);
						}
						else
						{

							MessageBox.Show("短信发送失败,请重试!","出错了!",
								MessageBoxButtons.OK,MessageBoxIcon.Information);
							return;
						}
					}
					else
					{	
						MessageBox.Show("短信发送失败,请重试!","出错了!",
							MessageBoxButtons.OK,MessageBoxIcon.Information);
						return;
					}
				}
				catch(Exception ex)
				{
					MessageBox.Show(ex.Message);
				}
			}

			else
			{
				sendMobilePhone = sendMobilePhone.Substring(0,sendMobilePhone.Length-1);

				string[] sendMobilePhones = sendMobilePhone.Split(new char[]{','});

				foreach(string phoneNumber in sendMobilePhones)
				{
					try
					{
						string spNumber = string.Empty;

						switch(phoneNumber.Substring(2,1))
						{
							case "0":
								spNumber = "9002733";
								break;
							case "1":
								spNumber = "9002733";
								break;
							case "2":
								spNumber = "9002733";
								break;
							case "3":
								spNumber = "9002733";
								break;
							case "4":
								spNumber = "9002733";
								break;
							case "5":
								spNumber = "8002733";
								break;
							case "6":
								spNumber = "8002733";
								break;
							case "7":
								spNumber = "8002733";
								break;
							case "8":
								spNumber = "8002733";
								break;
							case "9":
								spNumber = "8002733";
								break;
						}

						string url = "http://202.96.236.81:7783/testDownMsg.asp?"
							+"UID=sap&psd=0F3E419C71C500FA1FC8&source="+spNumber+"&mobile="
							+phoneNumber+"&message="+memoEdit_Content.Text;

						XMLHTTP xmlHttp = new XMLHTTPClass();
						xmlHttp.open("POST" , url , false , null , null  );          
						xmlHttp.setRequestHeader( "Accept-Lauguage" , "zh-cn" );

						xmlHttp.send(null);

						if(xmlHttp.status == 200)
						{
							if(xmlHttp.responseText == "0")
							{
							}
							else
							{

								MessageBox.Show("短信发送失败,请重试!","出错了!",
									MessageBoxButtons.OK,MessageBoxIcon.Information);
								return;
							}
						}
						else
						{	
							MessageBox.Show("短信发送失败,请重试!","出错了!",
								MessageBoxButtons.OK,MessageBoxIcon.Information);
							return;
						}
					}
					catch(Exception ex)
					{
						MessageBox.Show(ex.Message,"出错了!",
							MessageBoxButtons.OK,MessageBoxIcon.Information);
					}
				}

				MessageBox.Show("操作完成!","完成!",
					MessageBoxButtons.OK,MessageBoxIcon.Information);
			}
		}