Connecting to a Webpage via a proxy
Okay, I need to know two things here.
#1 How to connect to a webpage through a proxy in Vb?
#2 How to get a list of local proxy's, via Vb.
Basicly I just want the user to be able to load the program, and get a list of local proxy's that work, and then connect to a webpage via that proxy. Thanks in advanced.
Re: Connecting to a Webpage via a proxy
Well here is what I have tested so far:
I am connecting with:
Winsock.Connect "216.104.196.225", 80
I checked if I was connected and it returns true, so I should be connected through that proxy now. Now, to test if it's working I added a browser control, and went to www.myipaddress.com and found that it was not actually connected through the proxy.
To test that the proxy actually worked, I used the same one with one of my browsers, and went to the same site, and the Ip was the proxy, like it's supposed to be. So in a nutshell, I don't think the connection worked, any idea?
Re: Connecting to a Webpage via a proxy
The Inet control properties let you enter a proxy.
Re: Connecting to a Webpage via a proxy
Does that proxy only work for Inet? Because I am using Winsock to connect to the webpages for a certain reason, and I prefer to stay with it.
Re: Connecting to a Webpage via a proxy
I think so. When you set up a proxy in IE, does apply to all internet connection?
Maybe you could use the Internet Connection settings in Control panel?
Re: Connecting to a Webpage via a proxy
I plan on doing this through a program. If Inet sets a proxy through your internet settings that would work, but how do you go about doing that?
Re: Connecting to a Webpage via a proxy
Using winsock through a proxy isn't that difficult..you just set the connection to the proxy IPA and port and include the desired server in the get. i.e., instead of retrieving "/index.html" you would retrieve "destination_url/index.html"
Re: Connecting to a Webpage via a proxy
As anotherVBnewbie said, HTTP-GET proxies are the easiest to use. Following up on that is the related CONNECT method proxy (ie: "CONNECT google.com:80") and SOCKS proxies. If you want to use socks, take a look at the RFC, it's pretty easy to understand.
Re: Connecting to a Webpage via a proxy
Quote:
Originally Posted by Inuyasha1782
Well here is what I have tested so far:
I am connecting with:
Winsock.Connect "216.104.196.225", 80
I checked if I was connected and it returns true, so I should be connected through that proxy now. Now, to test if it's working I added a browser control, and went to
www.myipaddress.com and found that it was not actually connected through the proxy.
To test that the proxy actually worked, I used the same one with one of my browsers, and went to the same site, and the Ip was the proxy, like it's supposed to be. So in a nutshell, I don't think the connection worked, any idea?
If you want to test if you connect through proxy via webbrowser activex control, don't think it will work. Cause webbrowser don't have a proxy setting properties.
And for msinet openurl method, what does it return?
I'm trying this kind of thing
webbrowser.document=inet.openurl(....)
won't work, anyone has an idea how can a webbrowser control use proxy to navigate the web?
Thanks
Re: Connecting to a Webpage via a proxy
I actually did something like this that required my VB6 app switch between real proxying and forwarding request to proxy servers. Since VB6 couldn't handle the "intense" nature of proxying, it crashed the IDE and everything.
I tried to port the project to vb.net, but that failed too...damn .NET picky event-raising hierarchy :(
Re: Connecting to a Webpage via a proxy
To use winsock with a proxy all you have to do is use the proxy information as the connect info and then include the complete URL you are wishing to connect with in the get portion of the winsock string. I don't have any code here to post but you should be able to find examples on the net somewhere.
If you use the inet api it will automatically be configured for the proxy if the user has entered the proxy information into IE and is, at least to me, the easiest way of enabling proxy use - not to mention that the winsock controller tends to memory leakage.