Exemplo n.º 1
0
 public Form1()
 {
     InitializeComponent();
     m_webPost     = new ClassHttpPost();
     textBox2.Text = "*****@*****.**";
     textBox3.Text = "123456";
 }
Exemplo n.º 2
0
        public static void FreshProc()
        {
            //×¢²á³É¹¦
            int i = 0;

            for (; ;)
            {
                i++;
                lock (m_objTest)
                {
                    m_iRegNum--;
                    if (m_iRegNum < 1)
                    {
                        return;
                    }
                }
                ClassHttpPost webPost = new ClassHttpPost();
                string        strUser = "******" + new Random().Next(5000).ToString() + i.ToString();
                string        strData = string.Format("username={0}&email={0}1@{0}.com&password=jjkad123&confirm_password=jjkad123&other%5Bmsn%5D=&other%5Bqq%5D=&other%5Boffice_phone%5D=&other%5Bhome_phone%5D=&other%5Bmobile_phone%5D=&way=3&othertxt=&agreement=1&act=act_register&Submit=",
                                                      strUser
                                                      );
                string strRet = webPost.GetHttpPage("http://www.ibeifeng.com/user.php",
                                                    "gb2312", "POST", "", strData,
                                                    "http://www.ibeifeng.com/user.php?act=register",
                                                    "*/*", "");
                if (strRet.IndexOf("×¢²á³É¹¦") > 0)
                {
                    Console.WriteLine(string.Format("{0}: {1}", m_iRegNum, strUser));
                }
            }
        }
Exemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         Stream stream = ClassHttpPost.GetHttpPageSteam("http://www.ofcard.com/image.jsp?", "gb2312", "get", "", "", "", "*/*", "");
         if (stream == null)
         {
             return;
         }
         List <byte> list = new List <byte>();
         while (true)
         {
             int data = stream.ReadByte();
             if (data == -1)
             {
                 break;
             }
             list.Add((byte)data);
         }
         byte[] bytes = list.ToArray();
         Response.Clear();
         Response.BinaryWrite(bytes);
     }
     catch (System.Exception ex)
     {
     }
 }
Exemplo n.º 4
0
        public bool Login(string strUser, string strPwd, string strCheckCode)
        {
            string strUrl = string.Format("http://www.ofcard.com/getrand.jsp?userpsw={0}&name={1}", strPwd, strUser);
            string strRet = ClassHttpPost.GetHttpPage(strUrl, "gb2312", "get", "", "", "http://www.ofcard.com/include/top1/login_iframe.jsp", "*/*", "");

            strPwd = strRet;
            strPwd = strPwd.Trim();
            strPwd = strPwd.Replace("\n", "");
            strPwd = strPwd.Replace("\r", "");
            strPwd = strPwd.Replace("\r\n", "");

            string strObjData = string.Format("{0}\r\n{1}\r\n{2}\r\n{3}\r\n{4}\r\n{5}\r\n{6}\r\n{7}\r\n{8}\r\n{9}",
                                              "--A",
                                              "Content-Disposition: form-data; name=\"nickName\"\r\n",
                                              strUser,
                                              "--A",
                                              "Content-Disposition: form-data; name=\"logPsw\"\r\n",
                                              strPwd,
                                              "--A",
                                              "Content-Disposition: form-data; name=\"code\"\r\n",
                                              strCheckCode,
                                              "--A--\r\n");

            strRet = ClassHttpPost.GetHttpPage("http://www.ofcard.com/loginperson.do", "gb2312", "post", "", strObjData, "http://www.ofcard.com/include/top1/login_iframe.jsp", "*/*", "multipart/form-data; boundary=A");
            if (strRet.IndexOf("欢迎您来到") > 0)//登录成功
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 5
0
        public bool GetPageData(int nPage)
        {
            ClassHttpPost webPost = new ClassHttpPost();
            string        strUrl  = string.Format("http://www.amazon.cn/gp/feature.html/ref={0}?ie=UTF8&docId={1}&plgroup={2}&plpage={3}",
                                                  m_strRef, m_strdocId, m_strgpid, nPage);

            if (m_iFreshType == 1)
            {
                if (m_strTempUrl == "")
                {
                    m_strTempUrl = "http://www.amazon.cn/s/ref=sr_nr_p_n_feature_eight_br_mrr_0?rh=n%3A816482051%2Cp_n_feature_eight_browse-bin%3A2051095051%2Cp_n_feature_eight_browse-bin%3A2051096051%2Cp_n_feature_eight_browse-bin%3A2051097051%2Cp_n_feature_eight_browse-bin%3A2051098051&sort=-pct-off&ie=UTF8&page={0}";
                }
                strUrl = string.Format(m_strTempUrl,
                                       nPage);
            }
            string strRet = webPost.GetHttpPage(strUrl,
                                                "utf-8", "get", "", "",
                                                "",
                                                "*/*", "");

            strRet = AnanyzePageData(strRet);


            return(true);
        }
Exemplo n.º 6
0
        //sohu reg
        private void button2_Click(object sender, EventArgs e)
        {
            //GetImageEx
            GoodsFresh    objFreshEx = new GoodsFresh();
            ClassHttpPost webPost    = new ClassHttpPost();

            objFreshEx.SetWebPost(webPost);
            string strRet = webPost.GetHttpPage("https://session.trionworlds.com/login?service=unspecified&locale=zh_CN",
                                                "gb2312", "get", "", "",
                                                "",
                                                "*/*", "");
            string strError = "";

            //  https://session.trionworlds.com/login;jsessionid=F355EBF3FCC45A052024921548FD6D59
            //<form id="fm1" class="clearfix" action="/login;jsessionid=46E8217B16B969395A786F70C63DB4F0" method="post">
            //
            string strUrl = GetKeyString(strRet, "id=\"fm1\" class=\"clearfix\" action=\"", "\"");

            strUrl = "https://session.trionworlds.com" + strUrl;
            string strCode = GetKeyString(strRet, "name=\"lt\" value=\"", "\"");;
            string strData = string.Format("[email protected]&password=l19b351k&lt={0}&_eventId=submit",
                                           strCode
                                           );

            strRet = webPost.GetHttpPage(strUrl,
                                         "gb2312", "POST", "", strData,
                                         "https://session.trionworlds.com/login?service=unspecified&locale=zh_CN",
                                         "*/*", "");
        }
Exemplo n.º 7
0
        public void GetDetailData(string strUrl)
        {
            ShowLogString(strUrl);
            ClassHttpPost webPost = new ClassHttpPost();
            string        strRet  = webPost.GetHttpPage(strUrl,
                                                        "utf-8", "get", "", "",
                                                        "",
                                                        "*/*", "");

            strRet = strRet.ToLower();
            strRet.Replace("id=asinredirect", "id=\"asinredirect\"");
            if (strRet.IndexOf("id=\"asinredirect\"") < 0)
            {
                AnanyzeData(strRet, strUrl);
                return;
            }

            string strSelect = GetKeyString(strRet, "id=\"asinredirect\"", "</select>");

            while (true)
            {
                int nPos = strSelect.IndexOf("<option");
                if (nPos < 0)
                {
                    break;
                }
                string strId = "";
                if (strSelect.IndexOf("=\"") > 0)
                {
                    strId = GetKeyString(strSelect, "value=\"", "\"");
                }
                else
                {
                    strId = GetKeyString(strSelect, "value", ">");
                }

                if (strId.IndexOf("-") > 0)
                {
                    int iii = 0;
                }

                if (strId != "" && strId.IndexOf("-") < 0)
                {
                    AddToListEx("http://www.amazon.cn/gp/product/" + strId);
                }
                else
                {
                    break;
                }
                nPos = strSelect.IndexOf(">", nPos);
                if (nPos < 0)
                {
                    break;
                }
                strSelect = strSelect.Substring(nPos);
            }
        }
Exemplo n.º 8
0
        public bool Order(bool bIsVip, int iNum, double iTotalPrice, int iMemintegral)
        {
            string strObjData = "";

            if (bIsVip)
            {
                strObjData = string.Format("userid=&Email2=&cardid=210207&hidcardid=2102&paytype=null&quantity={3}&memprice{4}&memintegral={5}&sms_text=&select_paygate=radiobutton&sh_mob={0}&paygate={1}&paygate1=&bankname={2}",
                                           "%C7%EB%CA%E4%D2%C6%B6%AF%CA%D6%BB%FA%BA%C5",
                                           "%D6%A7%B8%B6%B1%A6",
                                           "%D6%A7%B8%B6%B1%A6",
                                           iNum,
                                           iTotalPrice,
                                           iMemintegral
                                           );
            }
            else
            {
                //非会员模式订单
            }

            string strRet = ClassHttpPost.GetHttpPage("http://www.ofcard.com/order.do", "gb2312", "post", "", strObjData, "http://www.ofcard.com/card/210207.htm", "*/*", "");

            if (strRet.IndexOf("第二步:订单确认") < 0)
            {
                return(false);
            }
            string strCardNo = "";
            string strAmount = "";
            string strBefore = "<input name=\"OrderNo\" type=\"hidden\" value=\"";
            string strAfter  = "\"";

            strCardNo = GetKeyString(strRet, strBefore, strAfter);
            strBefore = "<input name=\"amount\" type=\"hidden\" value=\"";
            //<input name="amount" type="hidden" value="
            strAfter   = "\"";
            strAmount  = GetKeyString(strRet, strBefore, strAfter);
            strObjData = string.Format("paygate={0}&OrderNo={1}&paygate1=&amount={2}&cardid=210207",
                                       "%D6%A7%B8%B6%B1%A6",
                                       strCardNo,
                                       strAmount
                                       );

            strRet = ClassHttpPost.GetHttpPage("http://www.ofcard.com/updatebankstate.do", "gb2312", "post", "", strObjData, "http://www.ofcard.com/order.do", "*/*", "");
            if (strRet.IndexOf("正在转向支付页面") < 0)
            {
                return(false);
            }

            //	postData="paygate=&OrderNo=" & cardNo & "&paygate1=&amount=" & cardAmount & "&cardid=210207"

            strBefore = "<form name=\"qqbank\" action=\"";
            strAfter  = "\"";
            string strUrl = GetKeyString(strRet, strBefore, strAfter);

            return(true);
        }
Exemplo n.º 9
0
        private void FunProc()
        {
            //取得文件名
            //第一次,把文件名传过去,取得下载链接地址,服务器根据文件名是否存在,创建文件。
            //第二次及后续,将实际发送的文件流传上去,服务器根据标识串及文件偏移保存文件
            string     strPath = m_strPath;
            FileStream fs      = new FileStream(strPath, FileMode.Open);

            if (fs == null)
            {
                m_CallBack.NoticeProcess(-1, "");
                return;
            }
            string strUrl = "";

            m_webPost = new ClassHttpPost();
            long   iTotalLen    = fs.Length;
            long   iOperatedLen = 0;
            long   iMaxReadLen  = 102400;
            long   iLeftLen     = fs.Length;
            int    iIndex       = strPath.LastIndexOf('\\');
            string strFileName  = strPath.Substring(iIndex + 1);

            strFileName = "1" + strFileName;
            byte[] bt     = System.Text.Encoding.UTF8.GetBytes(strFileName);
            string strRet = CaculateFile(bt);

            if (strRet.IndexOf("ok") < 0)
            {
                //失败
                m_CallBack.NoticeProcess(-2, "");
            }
            strUrl = strRet.Substring(strRet.IndexOf(',') + 1);
            while (iLeftLen > 0)
            {
                int iRead = (int)(iLeftLen > iMaxReadLen ? iMaxReadLen : iLeftLen);
                iRead++;
                byte[] bData   = new byte[iRead];
                int    iOffset = iRead - 1;
                fs.Read(bData, 1, iOffset);
                bData[0] = (byte)'2';
                strRet   = CaculateFile(bData);
                if (strRet != "0")
                {
                    m_CallBack.NoticeProcess(-2, "");
                    break;
                }
                iOperatedLen += iOffset;
                iLeftLen     -= iOffset;
                if (m_CallBack != null)
                {
                    m_CallBack.NoticeProcess((int)(100 * iOperatedLen / iTotalLen), strUrl);
                }
            }
            fs.Close();
        }
Exemplo n.º 10
0
        public bool IsLogin()
        {
            string strRet = ClassHttpPost.GetHttpPage("http://www.ofcard.com/include/top1/login_iframe.jsp", "gb2312", "get", "", "", "", "*/*", "");

            if (strRet.IndexOf("") > 0)
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 11
0
        public void GetDetailDataEx(string strUrl)
        {
            ShowLogString(strUrl);
            ClassHttpPost webPost = new ClassHttpPost();
            string        strRet  = webPost.GetHttpPage(strUrl,
                                                        "utf-8", "get", "", "",
                                                        "",
                                                        "*/*", "");

            AnanyzeData(strRet, strUrl);
        }
Exemplo n.º 12
0
        private void button2_Click(object sender, EventArgs e)
        {
            Stream stream = ClassHttpPost.GetHttpPageSteam("http://www.ofcard.com/image.jsp?", "gb2312", "get", "", "", "", "*/*", "");

            List <byte> list = new List <byte>();

            while (true)
            {
                int data = stream.ReadByte();
                if (data == -1)
                {
                    break;
                }
                list.Add((byte)data);
            }
            File.WriteAllBytes("c:\\2.bmp", list.ToArray());
        }
Exemplo n.º 13
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            ListView listView1 = FindViewById <ListView>(Resource.Id.listView1);

            items                = new string[] { "Fruits", "Flower Buds" };
            listView1.Adapter    = new ArrayAdapter <String>(this, Android.Resource.Layout.SimpleListItem1, items);
            listView1.ItemClick += new EventHandler <ListView.ItemClickEventArgs>(OnListItemClick);
            Spinner spinner = FindViewById <Spinner>(Resource.Id.spinner1);

            spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
            var adapter = ArrayAdapter.CreateFromResource(
                this, Resource.Array.planets_array, Android.Resource.Layout.SimpleSpinnerItem);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinner.Adapter = adapter;

            Button mybutton1 = FindViewById <Button>(Resource.Id.MyButton1);

            mybutton1.Click += delegate
            {
                TextView textView1 = FindViewById <TextView>(Resource.Id.textView1);
                textView1.Text = "正在获取数据,请稍后......";
                ClassHttpPost webPost = new ClassHttpPost();
                webPost.GetHttpPageAsyc("http://www.web1800.com/web1800/hello.html", "utf-8", "GET", "", "", "", "*/*", "", response =>
                {
                    RunOnUiThread(() =>
                    {
                        textView1.Text = "网络访问返回结果:" + response;
                    });
                });
            };
            Button button1 = FindViewById <Button>(Resource.Id.button1);

            button1.Click += delegate
            {
                WebView webView = FindViewById <WebView>(Resource.Id.webView1);
                webView.LoadUrl(@"http://www.baidu.com");
            };
        }
Exemplo n.º 14
0
        public bool GetCheckCode()
        {
            try
            {
                Stream stream = ClassHttpPost.GetHttpPageSteam("http://www.ofcard.com/image.jsp?", "gb2312", "get", "", "", "", "*/*", "");

                List <byte> list = new List <byte>();
                while (true)
                {
                    int data = stream.ReadByte();
                    if (data == -1)
                    {
                        break;
                    }
                    list.Add((byte)data);
                }
                File.WriteAllBytes("c:\\2.bmp", list.ToArray());
                return(true);
            }
            catch (System.Exception ex)
            {
            }
            return(false);
        }
Exemplo n.º 15
0
 public void SetWebPost(ClassHttpPost webPost)
 {
     m_webPost = webPost;
 }
Exemplo n.º 16
0
        public bool Order(int iIsVip, int iNum, double iTotalPrice, int iMemintegral)
        {
            string strCardID = "210207";

            if (iTotalPrice < 60.00)
            {
                strCardID    = "210208";
                iMemintegral = 5;
                iNum         = 1;
            }
            string strObjData = "";

            if (iIsVip == 1)
            {
                strObjData = string.Format("userid=&Email2=&cardid={6}&hidcardid=2102&paytype=null&quantity={3}&memprice={4}&memintegral={5}&sms_text=&select_paygate=radiobutton&sh_mob={0}&paygate={1}&paygate1=&bankname={2}",
                                           "%C7%EB%CA%E4%D2%C6%B6%AF%CA%D6%BB%FA%BA%C5",
                                           "%D6%A7%B8%B6%B1%A6",
                                           "%D6%A7%B8%B6%B1%A6",
                                           iNum,
                                           iTotalPrice,
                                           iMemintegral,
                                           strCardID
                                           );
            }
            else
            {
                //非会员模式订单
                strObjData = string.Format("userid={6}&Email2={7}&cardid={8}&hidcardid=2102&paytype=null&quantity={3}&memprice={4}&memintegral={5}&sms_text=&select_paygate=radiobutton&sh_mob={0}&paygate={1}&paygate1=&bankname={2}",
                                           "%C7%EB%CA%E4%D2%C6%B6%AF%CA%D6%BB%FA%BA%C5",
                                           "%D6%A7%B8%B6%B1%A6",
                                           "%D6%A7%B8%B6%B1%A6",
                                           iNum,
                                           iTotalPrice,
                                           iMemintegral,
                                           HttpUtility.UrlEncode(m_strName, System.Text.Encoding.GetEncoding("gb2312")),
                                           HttpUtility.UrlEncode(m_strMail, System.Text.Encoding.GetEncoding("gb2312")),
                                           strCardID
                                           );
            }
            string strReffer = string.Format("http://www.ofcard.com/card/{0}.htm", strCardID);
            string strRet    = ClassHttpPost.GetHttpPage("http://www.ofcard.com/order.do", "gb2312", "post", "", strObjData, strReffer, "*/*", "");

            if (strRet.IndexOf("第二步:订单确认") < 0)
            {
                return(false);
            }
            string strCardNo = "";
            string strAmount = "";
            string strBefore = "<input name=\"OrderNo\" type=\"hidden\" value=\"";
            string strAfter  = "\"";

            strCardNo = GetKeyString(strRet, strBefore, strAfter);
            strBefore = "<input name=\"amount\" type=\"hidden\" value=\"";
            //<input name="amount" type="hidden" value="
            strAfter   = "\"";
            strAmount  = GetKeyString(strRet, strBefore, strAfter);
            strObjData = string.Format("paygate={0}&OrderNo={1}&paygate1=&amount={2}&cardid={3}",
                                       "%D6%A7%B8%B6%B1%A6",
                                       strCardNo,
                                       strAmount,
                                       strCardID
                                       );

            strRet = ClassHttpPost.GetHttpPage("http://www.ofcard.com/updatebankstate.do", "gb2312", "post", "", strObjData, "http://www.ofcard.com/order.do", "*/*", "");
            if (strRet.IndexOf("正在转向支付页面") < 0)
            {
                return(false);
            }

            strBefore = "<form name=\"qqbank\" action=\"";
            strAfter  = "\"";
            string strUrl     = GetKeyString(strRet, strBefore, strAfter);
            string strJscript = string.Format("<script>top.location='{0}'</script>", strUrl);

            Response.Write(strJscript);
            return(true);
        }
 private void FunProc()
 {
     //ȡ���ļ���
     //��һ�Σ����ļ�������ȥ��ȡ���������ӵ�ַ�������������ļ����Ƿ���ڣ������ļ���
     //�ڶ��μ���������ʵ�ʷ��͵��ļ�������ȥ�����������ݱ�ʶ�����ļ�ƫ�Ʊ����ļ�
     string strPath = m_strPath;
     FileStream fs = new FileStream(strPath, FileMode.Open);
     if (fs == null)
     {
         m_CallBack.NoticeProcess(-1,"");
         return;
     }
     string strUrl = "";
     m_webPost = new ClassHttpPost();
     long iTotalLen = fs.Length;
     long iOperatedLen = 0;
     long iMaxReadLen = 102400;
     long iLeftLen = fs.Length;
     int iIndex = strPath.LastIndexOf('\\');
     string strFileName = strPath.Substring(iIndex+1);
     strFileName = "1" + strFileName;
     byte[] bt = System.Text.Encoding.UTF8.GetBytes(strFileName);
     string strRet = CaculateFile(bt);
     if (strRet.IndexOf("ok") < 0)
     {
         //ʧ��
         m_CallBack.NoticeProcess(-2, "");
     }
     strUrl = strRet.Substring(strRet.IndexOf(',') + 1);
     while (iLeftLen > 0)
     {
         int iRead = (int)(iLeftLen > iMaxReadLen ? iMaxReadLen : iLeftLen);
         iRead++;
         byte[] bData = new byte[iRead];
         int iOffset = iRead - 1;
         fs.Read(bData, 1, iOffset);
         bData[0] = (byte)'2';
         strRet = CaculateFile(bData);
         if (strRet != "0")
         {
             m_CallBack.NoticeProcess(-2, "");
             break;
         }
         iOperatedLen += iOffset;
         iLeftLen -= iOffset;
         if (m_CallBack != null) m_CallBack.NoticeProcess((int)(100 * iOperatedLen / iTotalLen), strUrl);
     }
     fs.Close();
 }
Exemplo n.º 18
0
        private void button1_Click(object sender, EventArgs e)
        {
            // _GoodsFreshStr objInfoEx = new _GoodsFreshStr();
            //objInfoEx.strAcc = "aaa";
            TestStr1 bulder = new TestStr1();

            bulder.strAcc = "AAA";
            Hashtable tblHash = new Hashtable();

            bulder.strAcc = "AAABBB";

            _GoodsFreshStr objInfoExEx = new _GoodsFreshStr();

            string strDirectoryXls = System.AppDomain.CurrentDomain.BaseDirectory + "xlsfile";

            SaveToExcel(strDirectoryXls, null, "aaaaa");
            return;

            GoodsFresh    objFreshEx = new GoodsFresh();
            ClassHttpPost webPost    = new ClassHttpPost();

            objFreshEx.SetWebPost(webPost);

            string strDirect = System.AppDomain.CurrentDomain.BaseDirectory + "pic";

            if (!Directory.Exists(strDirect))
            {
                Directory.CreateDirectory(strDirect);
            }

            return;

            //string str = System.Web.HttpUtility.UrlEncode("你好", Encoding.GetEncoding("gb2312"));
            string str = string.Format("{0}    {1}", 519.0, 535.01);

            MessageBox.Show(str);
            return;

            TimerFunction();
            return;

            string         strAcc  = "heilongjiangjt";
            _GoodsFreshStr objInfo = new _GoodsFreshStr();

            DataContrl.GetDataCache(strAcc, ref objInfo);
            MessageBox.Show(objInfo.iFreshCount.ToString());
            objInfo.iFreshCount = 2;
            //DataContrl.InitFreshTime();
            DataContrl.GetDataCache(strAcc, ref objInfo);
            MessageBox.Show(objInfo.iFreshCount.ToString());
            return;

            IsSetIllegal(); return;

            _GoodsFreshStr goodInfo = new _GoodsFreshStr();
            bool           bRet     = DataContrl.GetDataCache("heilongjiangjt", ref goodInfo);

            if (!bRet)
            {
                return;
            }
            GoodsFresh objFresh = new GoodsFresh();

            objFresh.SetWebPost(goodInfo.webPost);
            bRet = objFresh.Login(goodInfo.strAcc, goodInfo.strPwd, true);
            string strError = "";

            objFresh.FreshQuick(out strError, out strError);
        }