J
jack.smith.sam
Hi All,
I want to get data from URLURL using Java. If I use wget as the
following, I will get the result:
wget --user-aget=Mozilla/5.0 --cookies=on "URLURL"
So I tried to use cookies in Java but can not figure out how. Here is
how I try to do that:
String Url="URLURL";
URL url = new URL(Url);
java.net.URLConnection conn = url.openConnection();
conn.setRequestProperty("User-Agent","Mozilla/5.0");
String myCookie = "";
conn.setRequestProperty("Cookie", myCookie);
conn.connect();
but it does not work.
Can you help me?
thanks a lot for you time.
I want to get data from URLURL using Java. If I use wget as the
following, I will get the result:
wget --user-aget=Mozilla/5.0 --cookies=on "URLURL"
So I tried to use cookies in Java but can not figure out how. Here is
how I try to do that:
String Url="URLURL";
URL url = new URL(Url);
java.net.URLConnection conn = url.openConnection();
conn.setRequestProperty("User-Agent","Mozilla/5.0");
String myCookie = "";
conn.setRequestProperty("Cookie", myCookie);
conn.connect();
but it does not work.
Can you help me?
thanks a lot for you time.