close
We need to use URLConnection class or HttpURLConnection class to set cookie.
The example is as below:
try
{
URL url = new URL("http://www.xxx.com");
URLConnection urlc = url.openConnection();
urlc.setRequestProperty("User-agent", "IE/6.0");
String str;
while(()!=null)
{
System.out.println(str);
}
}
catch(IOException e)
{
System.out.println(e);
}
全站熱搜