if($_GET['k'] != '' && $_GET['cookie'] == '1') { $key = $_GET['k']; $date_of_expiry = time() + ((7 * 24 * 60 * 60 * 52) * 10) ; setcookie( "key", $key, $date_of_expiry, 'infosniper.net/html/', 'infosniper.net' ); } else if($_GET['k'] != '') { $key = $_GET['k']; } else if($_COOKIE['key'] != '') { $key = $_COOKIE['key']; } else { $key = $_GET['k']; setcookie( "key", "", time()-60, 'infosniper.net/html/', 'infosniper.net' ); } $key = filter_var( $key, FILTER_SANITIZE_STRING ); // check for invalid or valid key $key_file = "accounts_paid/".trim ( $key ).".dta"; if ( !file_exists ( $key_file ) ) { // Invalid or No key show adds.... $invalidkey=1; $key = ''; } ?>
Integrate powerful IP geolocation services into your applications with our XML and JSON APIs.
InfoSniper offers two API endpoints for accessing IP geolocation data:
Endpoint: xml.php
Returns structured XML data - perfect for legacy systems and SOAP integrations.
Endpoint: json.php
Returns clean JSON data - ideal for modern web applications and REST APIs.
Both APIs require a valid API key. Get your API key here to start making requests.
| Parameter | Required | Description |
|---|---|---|
k |
Required | Your API key |
ip_address |
Required | IP address to lookup (IPv4 or IPv6) |
curl "https://www.infosniper.net/xml.php?k=YOUR_API_KEY&ip_address=8.8.8.8"
8.8.8.8
dns.google
Google LLC
United States
US
https://www.infosniper.net/country_flags/us.gif
CA
Mountain View
650
94043
807
America/Los_Angeles
-08:00
37.4056
-122.0775
999
5
| Parameter | Required | Description |
|---|---|---|
k |
Required | Your API key |
ip_address |
Required | IP address to lookup (IPv4 or IPv6) |
curl "https://www.infosniper.net/json.php?k=YOUR_API_KEY&ip_address=8.8.8.8"
{
"ipaddress": "8.8.8.8",
"hostname": "dns.google",
"provider": "Google LLC",
"country": "United States",
"countrycode": "US",
"countryflag": "https://www.infosniper.net/country_flags/us.gif",
"state": "CA",
"city": "Mountain View",
"areacode": "650",
"postalcode": "94043",
"dmacode": "807",
"timezone": "America/Los_Angeles",
"gmtoffset": "-08:00",
"latitude": "37.4056",
"longitude": "-122.0775",
"queries": "999",
"accuracy": "5"
}
result[0]->ipaddress . "\n";
echo "Country: " . $xml->result[0]->country . "\n";
echo "City: " . $xml->result[0]->city . "\n";
echo "Latitude: " . $xml->result[0]->latitude . "\n";
echo "Longitude: " . $xml->result[0]->longitude . "\n";
?>
import requests
import json
# JSON API Example
api_key = "YOUR_API_KEY"
ip_address = "8.8.8.8"
url = f"https://www.infosniper.net/json.php?k={api_key}&ip_address={ip_address}"
response = requests.get(url)
if response.status_code == 200:
data = response.json()
print(f"IP: {data['ipaddress']}")
print(f"Country: {data['country']}")
print(f"City: {data['city']}")
print(f"Latitude: {data['latitude']}")
print(f"Longitude: {data['longitude']}")
else:
print(f"Error: {response.status_code}")
// JSON API Example with Fetch
const apiKey = "YOUR_API_KEY";
const ipAddress = "8.8.8.8";
const url = `https://www.infosniper.net/json.php?k=${apiKey}&ip_address=${ipAddress}`;
fetch(url)
.then(response => response.json())
.then(data => {
console.log("IP:", data.ipaddress);
console.log("Country:", data.country);
console.log("City:", data.city);
console.log("Latitude:", data.latitude);
console.log("Longitude:", data.longitude);
})
.catch(error => {
console.error("Error:", error);
});
// JSON API Example with Node.js
const https = require("https");
const apiKey = "YOUR_API_KEY";
const ipAddress = "8.8.8.8";
const url = `https://www.infosniper.net/json.php?k=${apiKey}&ip_address=${ipAddress}`;
https.get(url, (response) => {
let data = "";
response.on("data", (chunk) => {
data += chunk;
});
response.on("end", () => {
const result = JSON.parse(data);
console.log("IP:", result.ipaddress);
console.log("Country:", result.country);
console.log("City:", result.city);
console.log("Latitude:", result.latitude);
console.log("Longitude:", result.longitude);
});
}).on("error", (error) => {
console.error("Error:", error);
});
# JSON API with cURL
curl -s "https://www.infosniper.net/json.php?k=YOUR_API_KEY&ip_address=8.8.8.8" | jq .
# XML API with cURL
curl -s "https://www.infosniper.net/xml.php?k=YOUR_API_KEY&ip_address=8.8.8.8"
# POST request example
curl -X POST "https://www.infosniper.net/json.php" \
-d "k=YOUR_API_KEY" \
-d "ip_address=8.8.8.8"
| Field | Type | Description | Example |
|---|---|---|---|
ipaddress |
String | The queried IP address | 8.8.8.8 |
hostname |
String | Reverse DNS hostname | dns.google |
provider |
String | Internet Service Provider | Google LLC |
country |
String | Country name | United States |
countrycode |
String | 2-letter country code | US |
countryflag |
String | URL to country flag image | https://www.infosniper.net/country_flags/us.gif |
state |
String | State/Province code | CA |
city |
String | City name | Mountain View |
areacode |
String | Phone area code | 650 |
postalcode |
String | ZIP/Postal code | 94043 |
dmacode |
String | DMA/Metro code | 807 |
timezone |
String | Timezone identifier | America/Los_Angeles |
gmtoffset |
String | GMT offset | -08:00 |
latitude |
String | Latitude coordinate | 37.4056 |
longitude |
String | Longitude coordinate | -122.0775 |
queries |
String | Remaining API queries | 999 |
accuracy |
String | Accuracy radius in miles | 5 |
When an invalid or missing API key is provided:
{
"ipaddress": "Not a valid InfoSniper key",
"hostname": "Not a valid InfoSniper key",
"provider": "Not a valid InfoSniper key",
...
}
When your API quota has been exceeded:
{
"ipaddress": "8.8.8.8",
"hostname": "Quota exceeded",
"provider": "Quota exceeded",
...
}
When an invalid IP address is provided:
{
"ipaddress": "Invalid-IP-Address",
"hostname": "Invalid-IP-Address",
"provider": "Invalid-IP-Address",
...
}
Credits expire 12 months after the last usage date.
This means your credits remain active as long as you make at least one API call within any 12-month period. If no API calls are made for 12 consecutive months, remaining credits will expire. Monthly subscription credits do not expire while the subscription is active.
InfoSniper is part of a suite of IP intelligence services. For tracking, logging, and email analysis, see our sister site: