Closed odv closed 4 years ago
function queryIP(a) {
fetch(`https://geo.ipify.org/api/v1?apiKey=at_FCRibpiLKO03V0l6G9Daiyd4q31He&ipAddress=${a}`)
.then((response) => {
return response.json();
})
.then((myJson) => {
console.log(`Country: ${myJson.location.country},`);
console.log(`city: ${myJson.location.city},`);
console.log(`ISP: ${myJson.isp}`);
});}
Use ipfy API: https://geo.ipify.org/signup Documentation: https://geo.ipify.org/docs
Fetch: https://geo.ipify.org/api/v1?apiKey=YOUR_API_KEY&ipAddress=8.8.8.8
YOUR_API_KEY is your actual API key that you received when signing up
ipAddress will be the actual ip address you receive as input.
DO NOT PASTE API KEY IN COMMENTS. ALWAYS KEEP IT PRIVATE!
Example output: "Country: US, city: Mountain View, ISP: Google LLC"