I have been trying to make a simple proxy checker...
WebProxy myProxy = default(WebProxy);
foreach (string proxy in Proxies)
{
try
{
myProxy = new WebProxy(proxy);
HttpWebRequest r = HttpWebRequest.Create("<a href="http://www.google.com"" rel="nofollow">http://www.google.com"</a>);
r.UserAgent = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.2 Safari/537.36";
r.Timeout = 3000;
r.Proxy = myProxy;
HttpWebResponse re = r.GetResponse();
Console.WriteLine($"[+] {proxy} Good", ConsoleColor.Green);
}
catch (Exception)
{
Console.WriteLine($"[-] {proxy} Bad", ConsoleColor.Red);
}
}
for some reason this line:
HttpWebRequest r = HttpWebRequest.Create("<a href="http://www.google.com"" rel="nofollow">http://www.google.com"</a>);
I see a little red line under the http, and this is the error I get
The best overload for Create does not have a parameter names http
How can I fix it? and I how can I make it check proxies reall fast, not like 1 proxy every 5 seconds
The HttpWebRequest
class's Create
method takes the URL as a string, not HTML:
HttpWebRequest r = HttpWebRequest.Create("http://www.google.com");
Since there's actually no Create
on HttpWebRequest
, but only on WebRequest
, your code is most likely actually this:
HttpWebRequest r = WebRequest.Create("http://www.google.com");
But what you want is this:
HttpWebRequest r = (HttpWebRequest)WebRequest.Create("http://www.google.com");