Trying to bypass proxy
hey I am a beginner and stuck on something....
My college has a proxy that I am trying to bypass...
Everytime I try to open a page it redirects to a page that asks for policy acknowledgement.. for which we have to click a link..
I want to bypass that clicking part.. for without clicking none of the internet applications work ...
For suppose I type Google in the browser I get this page (trimmed_) :
Notice the <a> tag there.. that's what I want to capture.. I know how to parse HTML as such... Here's the snippet I am doing to open connection :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Notification: Policy Acknowledgement</title>
<a href="http://10.10.2.15/0:3600:86400:4ba74287/ad776dc33401e888760f72399c80c6ff/http://www.nitk.ac.in">Click here to accept this statement and access the Internet.</a>
Time: Mon, 22 Mar 2010 15:42:23 IST<br>IP Address: 172.16.54.143<br>
my problem is that this returns a 403 error..... while if I open the URL in a browser ... I get the page I mentioned above... How can I read 'THAT' page in java... maybe the server detects the page is not being opened in a browser.....Any Ideas...
ucon = u.openConnection(); //ucon is URLConnection, u is URL
Reader inp = new InputStreamReader((InputStream) u.getContent());
Additional Question... Suppose I get the link... What should I do to simulate a 'CLICK' on it??? Can I just connect to that URL and the server would think the user clicked on it???
Your school's routers are blocking your requests and sending you that error page. Unlike the movies, I seriously doubt you will find a way past them.
To use the school's proxy, look at Proxy and URL.openConnection(Proxy proxy). That will allow you to follow the school's procedures without the annoying error pages.
Did you try using correct system properties. Please try with 'http.proxyHost' and 'http.proxyPort'