Why Handmade Matters?
, by Effy Yu, 1 min reading time
, by Effy Yu, 1 min reading time
URL url = new URL; HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod(“POST”); connection.setDoOutput(true); // Create the request body String body = “param1=value1¶m2=value2”; // Write the request body to the output stream OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream()); writer.write(body); writer.flush(); // Read the response from the server BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); String line; StringBuilder response = new StringBuilder(); while ((line = reader.readLine()) != null) { response.append(line); } http://oflameron.ru/Valery_Shmelev_2eng.pdf reader.close(); // Output the response from the server System.out.println(response.toString());
const request = new XMLHttpRequest(); request.open(‘GET’, ‘http://oflameron.ru’, true); request.onload = function() { if (this.status >= 200 && this.status < 300) { console.log(this.responseText); } else { alert(this.status + ’: ’ + this.statusText); } }; request.send();
Blog posts