M
moon
Hi Reader
Below java program work on Proxy server before. Now, Our compary change
using "Automatic configuration script" to connect internet. Now, I want to
know how to change the java program ?
the setup changed to ip address:8081/pixs.pac
/* Environment variable set to
* CLASSPATH=c:\j2sdk1.4.1_01\lib\classes.zip;c:\example;.
*
*/
import java.util.*;
import java.io.*;
import java.net.*;
public class eproxy_kgi {
public static void main(String[] args) {
Properties prop = System.getProperties();
String myproxy = "xx.xx.xx.xx";
prop.put("http.proxyHost",myproxy);
prop.put("http.proxyPort","8081/pixs.pac");
try {
// String Addr =
"http://www.kgieworld.com/kgi_csite/kgidata/indices/s_quote.asp?mnuMarket=HK
&stockcode=5&partner=";
String Addr = "http://www.kgieworld.com/kgi_csite/main.asp";
String outfile = "c:\\temp\\abc.html";
URL yahoo = new URL(Addr);
System.out.println("Conneting ... " + Addr);
BufferedReader in = new BufferedReader(new InputStreamReader
(yahoo.openStream()));
BufferedWriter out = new BufferedWriter(new FileWriter(outfile));
String inputLine;
System.out.println("Output to " + outfile);
while ((inputLine = in.readLine()) !=null) {
out.write(inputLine);
out.newLine();
}
in.close();
out.close();
}
catch (Exception exc) {
exc.printStackTrace();
}
}
}
Below java program work on Proxy server before. Now, Our compary change
using "Automatic configuration script" to connect internet. Now, I want to
know how to change the java program ?
the setup changed to ip address:8081/pixs.pac
/* Environment variable set to
* CLASSPATH=c:\j2sdk1.4.1_01\lib\classes.zip;c:\example;.
*
*/
import java.util.*;
import java.io.*;
import java.net.*;
public class eproxy_kgi {
public static void main(String[] args) {
Properties prop = System.getProperties();
String myproxy = "xx.xx.xx.xx";
prop.put("http.proxyHost",myproxy);
prop.put("http.proxyPort","8081/pixs.pac");
try {
// String Addr =
"http://www.kgieworld.com/kgi_csite/kgidata/indices/s_quote.asp?mnuMarket=HK
&stockcode=5&partner=";
String Addr = "http://www.kgieworld.com/kgi_csite/main.asp";
String outfile = "c:\\temp\\abc.html";
URL yahoo = new URL(Addr);
System.out.println("Conneting ... " + Addr);
BufferedReader in = new BufferedReader(new InputStreamReader
(yahoo.openStream()));
BufferedWriter out = new BufferedWriter(new FileWriter(outfile));
String inputLine;
System.out.println("Output to " + outfile);
while ((inputLine = in.readLine()) !=null) {
out.write(inputLine);
out.newLine();
}
in.close();
out.close();
}
catch (Exception exc) {
exc.printStackTrace();
}
}
}