2013-02-27
2012-11-16
2012-06-28
2012-05-09
CODE - 用 java 發 get 的 http request
...
String getUrl = "http://xx.xx/test.php?sn=xx&path=xx";
URL url = new URL(getUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.connect();
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), "utf-8"));
loggerHelper.log("Contents of get request");
// 取得 return 值
String lines;
while ((lines = reader.readLine()) != null){
loggerHelper.log("lines: "+lines);
}
reader.close();
connection.disconnect();
...
cf :
http://www.jiucool.com/java-sending-http-requests-get-and-post-method-request/
http://www.exampledepot.com/egs/java.net/post.html
2012-04-10
2012-03-19
2012-03-09
2012-02-16
訂閱:
文章 (Atom)
