I am making a code that gets proxies from a txt file. but those proxies are in proxy:ip format. Now I want it to use as:
WebProxy myproxy = new WebProxy("202.141.226.154", 8080);
But how can I get my proxies there & working?
Getting proxies:
string proxy(string filee)
{
int counter = 0;
string line;
Console.WriteLine("Found these proxies:");
// Read the file and display it line by line.
System.IO.StreamReader file =
new System.IO.StreamReader(filee);
while ((line = file.ReadLine()) != null)
{
Console.WriteLine(line);
counter++;
}
Console.WriteLine("Total proxies:");
Console.WriteLine(counter);
file.Close();
return "lol";
}
Login with a proxy:
public static void MainLogin(string user, string pass)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://www.roblox.com/NewLogin");
string postData = String.Format("username={0}&password={1}&submitLogin=Log+In&ReturnUrl=", user, pass);
byte[] data = Encoding.UTF8.GetBytes(postData);
WebProxy myproxy = new WebProxy("202.141.226.154", 8080);
myproxy.BypassProxyOnLocal = false;
request.Proxy = myproxy;
request.Method = "POST";
request.AllowAutoRedirect = false;
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = data.Length;
using (var stream = request.GetRequestStream())
{
stream.Write(data, 0, data.Length);
}
reqCookie = RetrieveCookie(request);
}
So, how can I let them work together? Thanks!