Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const fetch = require("node-fetch")
- async function getIPInfo(ipAddress) {
- const response = await fetch(`https://db-ip.com/demo/home.php?s=${ipAddress}`, {
- headers: {
- 'Accept': '*/*',
- 'X-Requested-With': 'XMLHttpRequest',
- 'User-Agent': 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Mobile Safari/537.36',
- 'Referer': 'https://db-ip.com/'
- }
- });
- const result = await response.json();
- return result;
- }
- const ipInfo = await getIPInfo("1.1.1.1");
- console.log(JSON.stringify(ipInfo, null, 2));
Advertisement
Add Comment
Please, Sign In to add comment