🌐 提取IP接口
GET
提取代理IP
https://test.mojinyun.com/?key=YOUR_APP_KEY&sign=YOUR_SIGN&protocol=http&count=1&type=json&only=0&net=0&pw=1&province=&city=
请求参数
| 参数名 |
必选 |
类型 |
说明 |
| key |
是 |
string |
您的AppKey |
| sign |
是 |
string |
签名(MD5(key + timestamp + appSecret)) |
| protocol |
是 |
string |
协议类型:http, socks5 |
| count |
否 |
int |
提取数量,默认1,最大100 |
| type |
否 |
string |
返回格式:json, text,默认json |
| only |
否 |
int |
是否去重:1=是,0=否,默认0 |
| net |
否 |
int |
运营商:0=不限,1=电信,2=移动,3=联通 |
| pw |
否 |
int |
是否需要密码:1=是,0=否,默认1 |
| province |
否 |
string |
省份编号,见省市编码表 |
| city |
否 |
string |
城市编号,见省市编码表 |
返回示例(JSON格式)
{
"code": 0,
"msg": "ok",
"count": 1,
"data": [
{
"serverip": "112.85.129.215",
"port": 55986,
"user": "app_key",
"pwd": "password",
"ip": "101.96.147.186",
"net_type": 1,
"province": "北京",
"city": "北京",
"expire": "2025-10-30 22:11:14",
"from": "api"
}
]
}
返回参数说明
| 参数名 |
类型 |
说明 |
| code |
int |
状态码,0表示成功 |
| msg |
string |
返回消息 |
| count |
int |
返回IP数量 |
| serverip |
string |
代理服务器IP |
| port |
int |
代理端口 |
| user |
string |
代理用户名 |
| pwd |
string |
代理密码 |
| ip |
string |
真实出口IP |
| net_type |
int |
运营商类型:1=电信,2=移动,3=联通 |
| expire |
string |
IP过期时间 |
| from |
string |
来源:api=API提取,local=本地池 |
💻 调用示例
cURL
curl "https://test.mojinyun.com/?key=YOUR_KEY&sign=YOUR_SIGN&protocol=http&count=1&type=json"
Python
import requests
import hashlib
import time
app_key = 'YOUR_APP_KEY'
app_secret = 'YOUR_APP_SECRET'
timestamp = str(int(time.time() * 1000))
# 生成签名
sign_str = app_key + timestamp + app_secret
sign = hashlib.md5(sign_str.encode()).hexdigest()
# 请求参数
params = {
'key': app_key,
'sign': sign,
'protocol': 'http',
'count': 1,
'type': 'json',
'only': 1
}
# 发起请求
response = requests.get('https://test.mojinyun.com/', params=params)
data = response.json()
if data['code'] == 0:
for ip_info in data['data']:
proxy = f"http://{ip_info['user']}:{ip_info['pwd']}@{ip_info['serverip']}:{ip_info['port']}"
print(f"代理地址: {proxy}")
print(f"真实IP: {ip_info['ip']}")
print(f"过期时间: {ip_info['expire']}")
else:
print(f"错误: {data['msg']}")
PHP
$app_key,
'sign' => $sign,
'protocol' => 'http',
'count' => 1,
'type' => 'json',
'only' => 1
);
$url = 'https://test.mojinyun.com/?' . http_build_query($params);
// 发起请求
$response = file_get_contents($url);
$data = json_decode($response, true);
if ($data['code'] === 0) {
foreach ($data['data'] as $ip_info) {
$proxy = sprintf(
"http://%s:%s@%s:%d",
$ip_info['user'],
$ip_info['pwd'],
$ip_info['serverip'],
$ip_info['port']
);
echo "代理地址: {$proxy}\n";
echo "真实IP: {$ip_info['ip']}\n";
echo "过期时间: {$ip_info['expire']}\n";
}
} else {
echo "错误: {$data['msg']}\n";
}
?>
Node.js
const crypto = require('crypto');
const axios = require('axios');
const appKey = 'YOUR_APP_KEY';
const appSecret = 'YOUR_APP_SECRET';
const timestamp = Date.now();
// 生成签名
const signStr = appKey + timestamp + appSecret;
const sign = crypto.createHash('md5').update(signStr).digest('hex');
// 请求参数
const params = {
key: appKey,
sign: sign,
protocol: 'http',
count: 1,
type: 'json',
only: 1
};
// 发起请求
axios.get('https://test.mojinyun.com/', { params })
.then(response => {
const data = response.data;
if (data.code === 0) {
data.data.forEach(ipInfo => {
const proxy = `http://${ipInfo.user}:${ipInfo.pwd}@${ipInfo.serverip}:${ipInfo.port}`;
console.log(`代理地址: ${proxy}`);
console.log(`真实IP: ${ipInfo.ip}`);
console.log(`过期时间: ${ipInfo.expire}`);
});
} else {
console.error(`错误: ${data.msg}`);
}
})
.catch(error => {
console.error('请求失败:', error.message);
});