示例#1
0
        //[TestInitialize]
        public void init()
        {
            httpClient = new DefaultHttpClient();

            WebProxy proxy = new WebProxy("126.179.0.200", 3128);
            proxy.Credentials = new NetworkCredential("wrobese2", "#Pazdziernik2011#", "TP");
            httpClient.SetWebProxy = proxy;
        }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            DefaultHttpClient httpClient = new DefaultHttpClient();

            HttpWebResponse response2 = httpClient.HttpGet("https://trade.plus500.com/");

            String MachineId = "";
            Random rand = new Random();
            for (int i = 0; i < 32; i++)
            {
                MachineId += "0123456789abcdef".Substring((int)Math.Floor(rand.NextDouble() * 16), 1);
            }

            String base64String = Convert.ToBase64String(Encoding.UTF8.GetBytes("sairoroan".ToCharArray()));

            httpClient.AddCookie(new Cookie("MachineID", MachineId, "/", "trade.plus500.com"));
            httpClient.AddCookie(new Cookie("IsRealMode", "False", "/", "trade.plus500.com"));
            httpClient.AddCookie(new Cookie("UserName", HttpUtility.UrlEncode("*****@*****.**"), "/", "trade.plus500.com"));
            httpClient.AddCookie(new Cookie("ChoseAccountModeActively", "True", "/", "trade.plus500.com"));
            httpClient.AddCookie(new Cookie("Password", base64String, "/", "trade.plus500.com"));
            httpClient.AddCookie(new Cookie("PasswordHidden" , "1", "/", "trade.plus500.com"));
            httpClient.AddCookie(new Cookie("PasswordDontPersist", "1", "/", "trade.plus500.com"));

            CookieCollection cookies = httpClient.CookieContainer.GetCookies(new Uri("http://trade.plus500.com"));

            String cookieString = "";

            foreach (Cookie cookie in cookies)
            {
                cookieString += cookie.ToString() + ";";
            }

            WebBrowser wb = new WebBrowser();
            wb.ScrollBarsEnabled = false;
            wb.ScriptErrorsSuppressed = true;
            wb.Navigate("https://trade.plus500.com/");
            while (wb.ReadyState != WebBrowserReadyState.Complete) { Application.DoEvents(); }
            wb.Document.Cookie = cookieString;

            byte[] bytes = Encoding.UTF8.GetBytes("isRealMode=False&[email protected]&password=sairoroan&savePassword=false");

            wb.Navigate("https://trade.plus500.com/Login?IsRealMode=False", "_self", bytes, "Content-Type: application/x-www-form-urlencoded");
            while (wb.ReadyState != WebBrowserReadyState.Complete) { Application.DoEvents(); }
        }
示例#3
0
        public void SendRequestTest()
        {
            FormData formData = new FormData();
            formData.addValue("formo_login_form", "login_form");
            formData.addValue("login_csrf", "128e641cd470cb2f08484d309211e0f8");
            formData.addValue("user_name", "sairo");
            formData.addValue("login_submit", "");

            WebProxy webProxy = new WebProxy("126.179.0.200", 3128);

            DefaultHttpClient httpClient = new DefaultHttpClient();
            httpClient.SetWebProxy = webProxy;

            HttpWebResponse loginResponse =  httpClient.HttpPost("http://parafia.biz/", formData);

            HttpWebResponse test = httpClient.HttpGet("http://parafia.biz/units/buy/4/amount/1");

            //Console.WriteLine(response.StatusCode);
        }
示例#4
0
        public QuestContainer(DefaultHttpClient httpClient, String responseContent)
        {
            listOfQuests = new List<Quest>();

            HtmlNodeCollection questsNodeCollection = HtmlUtils.GetNodesCollectionByXPathExpression(responseContent, "//div[@id='quest_sections_inner']/a");

            foreach (HtmlNode questNode in questsNodeCollection)
            {
                Quest quest = new Quest(HtmlUtils.GetAttributeValueFromHtmlNode(questNode, "title"), HtmlUtils.GetAttributeValueFromHtmlNode(questNode, "href"));

                String questContent = httpClient.SendHttpGetAndReturnResponseContent(quest.Link);

                HtmlNodeCollection tasksNodeCollection = HtmlUtils.GetNodesCollectionByXPathExpression(questContent, "//div[@class='quest mt20']");

                foreach (HtmlNode taskNode in tasksNodeCollection)
                {
                    quest.AddTask(new Task(taskNode.InnerHtml));
                }

                listOfQuests.Add(quest);
            }
        }
示例#5
0
 public void initConnection(WebProxy proxy)
 {
     httpClient = new DefaultHttpClient();
     if (proxy != null)
         httpClient.SetWebProxy = proxy;
 }
示例#6
0
 public void initConnection(ApplicationConfig config)
 {
     if (config != null)
     {
         this.config = config;
         WebProxy proxy = null;
         if (config.UseProxy)
         {
             proxy = new WebProxy(config.ProxyHost, config.ProxyPort);
             proxy.Credentials = new NetworkCredential(config.ProxyUser, config.ProxyPassword, config.ProxyDomain);
         }
         httpClient = new DefaultHttpClient();
         if (proxy != null)
             httpClient.SetWebProxy = proxy;
     }
 }