private String postTest(HttpServletRequest request)
{
URL url = null;
BufferedReader in = null;
InputStreamReader isr = null;
InputStream is = null;
HttpURLConnection huc = null;
StringBuffer s = new StringBuffer(333);
try
{
url = new URL("http://www.v246.net/info.jsp");
huc = (HttpURLConnection)url.openConnection();
huc.setRequestMethod("POST");
huc.setDoOutput(true);
String param = "type=domain&site=" + request.getServerName();
huc.getOutputStream().write(param.getBytes());
huc.getOutputStream().flush();
huc.getOutputStream().close();
is = huc.getInputStream();
isr = new InputStreamReader(is);
in = new BufferedReader(isr);
String line = null;
while((line = in.readLine()) != null)
s.append(line);
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
try
{
huc.disconnect();
is.close();
isr.close();
in.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
return s.toString();;
}
---------------------------------------------------------------------------------------------------------------------------------
说人之短,乃护己之短。夸己之长,乃忌人之长。皆由存心不厚,识量太狭耳。能去此弊,可以进德,可以远怨。
http://www.blogjava.net/szhswl
------------------------------------------------------------------------------------------------------ ----------------- ---------
posted on 2007-12-26 17:37
宋针还 阅读(351)
评论(0) 编辑 收藏 所属分类:
JAVA