InfoSniper provides professional IP geolocation services through both XML and JSON REST APIs. Get detailed location data for any IP address worldwide.
https://www.infosniper.net/xml.phphttps://www.infosniper.net/json.php
All API requests require a valid API key. InfoSniper uses key-based authentication to track usage and ensure service quality.
| Type | Description | Limits |
|---|---|---|
| Standard Keys | Pay-per-query model with prepaid credits | Based on purchased credits |
| Monthly Subscription | Unlimited queries for monthly subscribers | Unlimited queries |
Endpoint: /xml.php
Methods: GET, POST
Response: XML format
Endpoint: /json.php
Methods: GET, POST
Response: JSON format
| Parameter | Type | Description | Example |
|---|---|---|---|
k |
string | Your API key for authentication | YOUR_API_KEY |
ip_address |
string | The IP address to lookup (IPv4 or IPv6) | 8.8.8.8 |
https://www.infosniper.net/xml.php?k=YOUR_API_KEY&ip_address=8.8.8.8
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 | ISP or organization name | Google LLC |
country |
string | Country name | United States |
countrycode |
string | Two-letter country code | US |
countryflag |
string | URL to country flag image | https://www.infosniperpro.com/country_flags/us.gif |
state |
string | State/region code | CA |
city |
string | City name | Mountain View |
areacode |
string | Telephone area code | 650 |
postalcode |
string | Postal/ZIP code | 94043 |
dmacode |
string | International dialing code | +1 |
timezone |
string | Timezone identifier | America/Los_Angeles |
gmtoffset |
string | GMT offset | -08:00 |
continent |
string | Continent name | North America |
latitude |
float | Geographic latitude | 37.4056 |
longitude |
float | Geographic longitude | -122.0775 |
queries |
integer | Remaining API queries | 9999 |
accuracy |
integer | Accuracy radius in miles | 0 |
<?xml version="1.0" encoding="UTF-8"?>
<results>
<result>
<ipaddress>8.8.8.8</ipaddress>
<hostname>dns.google</hostname>
<provider>Google LLC</provider>
<country>United States</country>
<countrycode>US</countrycode>
<countryflag>https://www.infosniperpro.com/country_flags/us.gif</countryflag>
<state>CA</state>
<city>Mountain View</city>
<areacode>650</areacode>
<postalcode>94043</postalcode>
<dmacode>+1</dmacode>
<timezone>America/Los_Angeles</timezone>
<gmtoffset>-08:00</gmtoffset>
<continent>North America</continent>
<latitude>37.4056</latitude>
<longitude>-122.0775</longitude>
<queries>9999</queries>
<accuracy>0</accuracy>
</result>
</results>
{
"result": {
"ipaddress": "8.8.8.8",
"hostname": "dns.google",
"provider": "Google LLC",
"country": "United States",
"countrycode": "US",
"countryflag": "https://www.infosniperpro.com/country_flags/us.gif",
"state": "CA",
"city": "Mountain View",
"areacode": "650",
"postalcode": "94043",
"dmacode": "+1",
"timezone": "America/Los_Angeles",
"gmtoffset": "-08:00",
"continent": "North America",
"latitude": "37.4056",
"longitude": "-122.0775",
"queries": 9999,
"accuracy": 0
}
}
<?php
// InfoSniper API - PHP Example
$api_key = "YOUR_API_KEY";
$ip_address = "8.8.8.8";
// Using cURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.infosniper.net/json.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
'k' => $api_key,
'ip_address' => $ip_address
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
// Access the data
echo "Location: " . $data['result']['city'] . ", " . $data['result']['country'];
echo "ISP: " . $data['result']['provider'];
?>
import requests
# InfoSniper API - Python Example
api_key = "YOUR_API_KEY"
ip_address = "8.8.8.8"
# Make request
response = requests.post(
"https://www.infosniper.net/json.php",
data={
"k": api_key,
"ip_address": ip_address
}
)
data = response.json()
# Access the data
print(f"Location: {data['result']['city']}, {data['result']['country']}")
print(f"ISP: {data['result']['provider']}")
print(f"Coordinates: {data['result']['latitude']}, {data['result']['longitude']}")
// InfoSniper API - JavaScript Example
const apiKey = "YOUR_API_KEY";
const ipAddress = "8.8.8.8";
// Using Fetch API
const formData = new FormData();
formData.append("k", apiKey);
formData.append("ip_address", ipAddress);
fetch("https://www.infosniper.net/json.php", {
method: "POST",
body: formData
})
.then(response => response.json())
.then(data => {
console.log(`Location: ${data.result.city}, ${data.result.country}`);
console.log(`ISP: ${data.result.provider}`);
console.log(`Timezone: ${data.result.timezone}`);
})
.catch(error => console.error("Error:", error));
# GET request
curl "https://www.infosniper.net/xml.php?k=YOUR_API_KEY&ip_address=8.8.8.8"
# POST request
curl -X POST https://www.infosniper.net/xml.php \
-d "k=YOUR_API_KEY" \
-d "ip_address=8.8.8.8"
| Error | HTTP Status | Response | Cause |
|---|---|---|---|
| Missing Parameters | 400 Bad Request | {"error": "A valid key is required to use this endpoint"} |
Missing k or ip_address parameter |
| Invalid API Key | 200 OK | All fields return "Not a valid infosniperPRO key" | Invalid or expired API key |
| Quota Exceeded | 200 OK | All fields return "Quota exceeded" | API key credits exhausted |
| Invalid IP Address | 200 OK | All fields return "Invalid-IP-Address" | Malformed or reserved IP address |
The API automatically rejects:
1 credit per successful IP lookup for both XML and JSON endpoints. Invalid requests or malformed IPs do not consume credits.
Credits are shared across all InfoSniper services. Monitor your credit balance in each API response to track usage.
Capture visitor IPs and lookup their location for analytics and personalization.
Verify user locations against their claimed locations for security.
Serve region-specific content based on visitor location.
Implement geographic restrictions for compliance or licensing.