Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import java.io.*;
import java.net.*;
public class ReadLicence {
public static String valida(String key) throws Exception {
StringBuilder result = new StringBuilder();
URL url = new URL("http://site.com.br/verificarlicenca?licenca=" + key);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
while ((line = rd.readLine()) != null) {
result.append(line);
}
rd.close();
return result.toString();
}
public static void main(String[] args) throws Exception {
System.out.println(valida(args[0]));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.