文煞站长资源网,IP查询API接口 - 免费IP地理位置查询服务平台,免费、准确、实时的IP地址查询服务,支持全球IP定位!该api接口根据用户等级,每日可调用API的次数不同。升级VIP可获得更高调用额度。普通用户每日可调用1000次,基本可以满足个人日常需求了!
一、接口介绍
做项目时需要IP定位功能的开发者,别再到处找参差不齐的接口了!今天实测安利「文煞站长资源网IP地理位置查询接口」,免费、准确还实时,全球IP都能查,个人和小团队用着超省心。它不用复杂配置,登录就能拿user_id和secret,接口请求逻辑简单,返回数据特别规整——大洲、国家、省份、城市、区县甚至经纬度都能一键获取,不管是做用户地域统计、内容定向推送,还是小工具开发,都能直接用。 最关键的是稳定不抽风,之前试了好几个免费接口要么定位不准,要么频繁报错,这个接口亲测响应快,免费额度够日常测试,付费版性价比也高,没有隐形套路,几行代码就能接入,真心省时间!

二、接口核心规则
1. 接口地址:https://www.wszzw.cn/?wensha_ip=api
2. 必填参数(缺一不可): - user_id:登录后获取的专属用户ID - sign:签名(算法:md5(user_id + secret + random),secret登录后获取) - random:随机字符串(建议用时间戳,确保每次请求唯一)
3. 可选参数: - ip:要查询的IP(不传则自动查询本机IP)
4. 成功返回JSON:包含大洲、国家、省份、城市、区县、经纬度等完整信息
5. 同款zblog插件:https://www.wszzw.cn/post/396.html
三、准确的多语言调用案例
1. PHP调用案例(对照官网示例优化)
<?php
// 替换为你登录后获取的真实user_id和secret
$user_id = '你的真实user_id';
$secret = '你的真实secret密钥';
$random = time(); // 用时间戳当随机字符串,简单高效
$sign = md5($user_id . $secret . $random); // 按官网规则生成签名
$ip = '8.8.8.8'; // 要查询的IP,不传则查本机IP(删除&ip=$ip即可)
// 构建完整请求URL(严格对照接口地址和参数名)
$url = "https://www.wszzw.cn/?wensha_ip=api&user_id={$user_id}&sign={$sign}&random={$random}&ip={$ip}";
// 发送请求并处理结果
$result = file_get_contents($url);
$data = json_decode($result, true);
if ($data['code'] == 200) {
echo "查询成功:\n";
echo "大洲:" . $data['data']['continent'] . "\n";
echo "国家:" . $data['data']['country'] . "\n";
echo "省份:" . $data['data']['province'] . "\n";
echo "城市:" . $data['data']['city'] . "\n";
echo "区县:" . $data['data']['district'] . "\n";
echo "经纬度:" . $data['data']['longitude'] . "," . $data['data']['latitude'] . "\n";
} else {
echo "查询失败:" . $data['msg'] . "\n";
}
?>2. Python调用案例
import requests
import hashlib
import time
# 替换为你的真实信息
user_id = "你的真实user_id"
secret = "你的真实secret密钥"
random_str = str(time.time()) # 时间戳作为随机字符串
ip = "8.8.8.8" # 可选:要查询的IP,不传则查本机
# 生成签名(严格遵循md5(user_id + secret + random)规则)
sign_source = user_id + secret + random_str
sign = hashlib.md5(sign_source.encode()).hexdigest()
# 构建请求参数
params = {
"user_id": user_id,
"sign": sign,
"random": random_str,
"ip": ip # 不传则删除该参数
}
# 发送请求
url = "https://www.wszzw.cn/?wensha_ip=api"
try:
response = requests.get(url, params=params, verify=False)
if response.status_code == 200:
result = response.json()
if result["code"] == 200:
print("查询成功:")
print(f"大洲:{result['data']['continent']}")
print(f"国家:{result['data']['country']}")
print(f"省份:{result['data']['province']}")
print(f"城市:{result['data']['city']}")
print(f"区县:{result['data']['district']}")
print(f"经纬度:{result['data']['longitude']},{result['data']['latitude']}")
else:
print(f"查询失败:{result['msg']}")
else:
print(f"请求失败,状态码:{response.status_code}")
except Exception as e:
print(f"调用异常:{str(e)}")3. Java调用案例(按接口规则实现)
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.HttpResponse;
import java.security.MessageDigest;
import java.util.HashMap;
import java.util.Map;
public class IpQueryApiDemo {
// 替换为你的真实信息
private static final String USER_ID = "你的真实user_id";
private static final String SECRET = "你的真实secret密钥";
private static final String API_URL = "https://www.wszzw.cn/?wensha_ip=api";
public static void main(String[] args) {
String randomStr = String.valueOf(System.currentTimeMillis()); // 时间戳作为随机字符串
String ip = "8.8.8.8"; // 可选:要查询的IP
// 生成MD5签名
String sign = generateMd5(USER_ID + SECRET + randomStr);
// 构建请求参数
Map<String, String> params = new HashMap<>();
params.put("user_id", USER_ID);
params.put("sign", sign);
params.put("random", randomStr);
params.put("ip", ip); // 不传则删除该参数
// 拼接请求URL
StringBuilder urlBuilder = new StringBuilder(API_URL);
urlBuilder.append("?");
for (Map.Entry<String, String> entry : params.entrySet()) {
urlBuilder.append(entry.getKey()).append("=").append(entry.getValue()).append("&");
}
String requestUrl = urlBuilder.substring(0, urlBuilder.length() - 1);
// 发送请求并处理结果
try (CloseableHttpClient client = HttpClients.createDefault()) {
HttpGet httpGet = new HttpGet(requestUrl);
HttpResponse response = client.execute(httpGet);
String responseStr = EntityUtils.toString(response.getEntity());
// 解析JSON(可使用FastJSON等工具类优化)
System.out.println("响应结果:" + responseStr);
// 实际项目中可解析code、msg、data等字段
} catch (Exception e) {
e.printStackTrace();
}
}
// MD5加密工具方法(适配签名规则)
private static String generateMd5(String str) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] bytes = md.digest(str.getBytes());
StringBuilder sb = new StringBuilder();
for (byte b : bytes) {
String hex = Integer.toHexString(b & 0xFF);
if (hex.length() == 1) sb.append("0");
sb.append(hex);
}
return sb.toString();
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
}
> 依赖说明(Maven):
> xml
> <dependency>
> <groupId>org.apache.httpcomponents</groupId>
> <artifactId>httpclient</artifactId>
> <version>4.5.14</version>
> </dependency>
> <!-- 如需解析JSON,可添加FastJSON依赖 -->
> <dependency>
> <groupId>com.alibaba</groupId>
> <artifactId>fastjson</artifactId>
> <version>1.2.83</version>
> </dependency>4. JS调用案例(Node.js环境)
const axios = require('axios');
const crypto = require('crypto');
// 替换为你的真实信息
const userId = "你的真实user_id";
const secret = "你的真实secret密钥";
const randomStr = Date.now().toString(); // 时间戳作为随机字符串
const ip = "8.8.8.8"; // 可选:要查询的IP
// 生成MD5签名
const signSource = userId + secret + randomStr;
const sign = crypto.createHash('md5').update(signSource).digest('hex');
// 构建请求参数
const params = {
user_id: userId,
sign: sign,
random: randomStr,
ip: ip // 不传则删除该参数
};
// 发送GET请求
const apiUrl = "https://www.wszzw.cn/?wensha_ip=api";
axios.get(apiUrl, { params, httpsAgent: new (require('https').Agent)({ rejectUnauthorized: false }) })
.then(response => {
const result = response.data;
if (result.code === 200) {
console.log("查询成功:");
console.log(`大洲:${result.data.continent}`);
console.log(`国家:${result.data.country}`);
console.log(`省份:${result.data.province}`);
console.log(`城市:${result.data.city}`);
console.log(`区县:${result.data.district}`);
console.log(`经纬度:${result.data.longitude},${result.data.latitude}`);
} else {
console.log(`查询失败:${result.msg}`);
}
})
.catch(error => {
console.log(`调用异常:${error.message}`);
});注意:执行前需安装依赖:npm install axios;浏览器端调用需处理跨域(建议通过后端中转)。








