Send HTTP Get message

import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; public class HTTPService{ public void sendGet() throws IOException{ URL url = new URL("<URL>"); HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setRequestMethod("GET"); con.setRequestProperty("User-Agent", "Mozilla/5.0"); con.getResponseCode(); } }
Send a get message to a specific <URL>

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.