Advertisement
Guest User

Untitled

a guest
Jun 25th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. const string uri = "https://darkorbit.com/login/index.php";
  2. HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(uri);
  3. wr.KeepAlive = true;
  4. wr.Method = "POST";
  5. wr.AllowAutoRedirect = false;
  6. wr.Proxy = p;
  7. wr.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
  8. wr.ContentType = "application/x-www-form-urlencoded";
  9. wr.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36";
  10. string pdata = "username=USERNAME&password=PASSWORD";
  11. byte[] data = UTF8Encoding.UTF8.GetBytes(pdata);
  12. wr.ContentLength = data.Length;
  13. CookieContainer cookie = new CookieContainer();
  14. wr.CookieContainer = cookie;
  15. using (Stream poststream = wr.GetRequestStream())
  16. {
  17. poststream.Write(data, 0, data.Length);
  18. }
  19. HttpWebResponse wp = (HttpWebResponse)wr.GetResponse();
  20. wr.CookieContainer.Add(wp.Cookies);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement