Last active
May 28, 2020 15:32
-
-
Save laurentpellegrino/6e28d8cfab21b37a38b873cec94342ba to your computer and use it in GitHub Desktop.
Consecutive private local IP lookup using Ipregistry API and apache HTTP client
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import java.net.URI; | |
import java.net.http.HttpClient; | |
import java.net.http.HttpRequest; | |
import java.net.http.HttpResponse; | |
public class IpregistryTest { | |
public static void main(String[] args) throws IOException, InterruptedException { | |
HttpClient client = HttpClient.newHttpClient(); | |
for (int i = 0; i < 10; i++) { | |
HttpRequest request = HttpRequest.newBuilder() | |
.header("Authorization", "Apikey tryout") | |
.uri(URI.create("https://api.ipregistry.co/192.168.1.149")) | |
.build(); | |
HttpResponse<String> response = | |
client.send(request, HttpResponse.BodyHandlers.ofString()); | |
System.out.println(response.body()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment