... 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
沒有留言:
張貼留言