Proxy Support

Fadi946

Power Member
Joined
Mar 25, 2009
Messages
621
Reaction score
93
Hi, so I'm done making a bot, but I need to make a proxy support on it so it can be perfect.
What I mean is, that I put a proxy list (from a .txt file) and it will automatically changes after doing a certain thing.
I really got no idea how to do this.
Can anyone please help?
Thanks.
 
First off. You would need to load up the list.
Proxy lists are usually in the form
yourproxyServer:yourProxyPort
So basically you can load up the text file one line each time look for the ":" and separate the two.

Then you need to define a proxy.
Dim proxyserver as string="19.168.0.1"
Dim proxyport as integer=80

Dim tempProxy As New System.Net.WebProxy(proxyserver, proxyport)

This webproxy can be used with both the HTTPWEBREQUEST methods and WebClient.

For the webrequest:
Dim request As WebRequest = HttpWebRequest.Create(url)
request.Timeout = 1000
request.Proxy = tempProxy
Dim response As WebResponse = request.GetResponse()

For the webclient:
Dim client As New WebClient
client.Proxy = tempProxy
Dim htmlsource=client.DownloadString(url)


Hope this makes sense.
 
Thanks so much, I've done something similar to this and it works, but not so sure if it REALLY works..
So basically I went to "www.WhatIsMyIP.com" using VB's webbrowser1, and I see that the IP is really changing.. but when I go to internet explorer (manually, not from VB), I go to whatismyip dot come and I see my real IP there...
So I don't know, does it work or not?

My code is this:
Edit: Nevermind, deleted the code.. It works great, thanks :)
 
Last edited:
I wouldn't suggest using the webbrowser control unless you absolutely have to use it, the webclient and webrequest are much better and can be multithreaded.
 
Yeah, christoss1959 is right.. Using the webbrowser is extremely slow and there's not a whole lot you can do with it.

Here's a good httpwebrequest example to learn from: http://www.808.dk/?code-vbnet-httpwebrequest

Also to split the proxies, it would be strProxy.Split(":"c)(0) - that's for the IP, (1) is for the port.

I have a heavily modified httpwebrequest function that handles invalid SSL certs and private proxies and such, PM me if you want it.

CM
 
Thanks for both of you, really helpful information... I've never heard of the webrequest thing, and it sounds so much better.. Because sometimes I just feel limited with the webBrowser.
I will take a lot at your link and will see how things will go.
 
U can also check out the chilkat component for vb.net applications.Thou its little buggy but still is useful.
 
Back
Top