Posted By:
Anin_Mathen
Posted On:
Monday, January 5, 2004 09:41 AM
Try this snippet...
try
{
String proxy_internet_address = "198.34.23.87";
int proxy_internet_port = 80;
ProxyAuthenticator proxAuth = new ProxyAuthenticator("userid","pwd");
java.net.Authenticator.setDefault(proxAuth);
URL url = new URL("http://yourodmain/url");
java.util.Properties systemProperties = System.getProperties();
systemProperties.setProperty("http.proxyHost",proxy_internet_address);
systemProperties.setProperty("http.proxyPort",String.valueOf(proxy_internet_port));
HttpURLConnection aConnection = (HttpURLConnection)(url.openConnection());
aConnection.setDoInput(true);
aConnection.setDoOutput(true);
aConnection.setUseCaches(false);
aConnection.connect();
InputStreamReader insr = new InputStreamReader(aConnection.getInputStream());
br = new BufferedReader(insr);
while((textString = br.readLine())!=null){
s = s + textString;
}
br.close();
aConnection.disconnect();
} catch(Exception ex) {
ex.printStackTrace();
}
Hope this helps.
Anin