🚀 快速开始

欢迎使用摩金云代理IP服务API。本文档将帮助您快速接入我们的服务。

接入步骤

  1. 注册账号并登录控制台
  2. 购买IP套餐,获取AppKey和AppSecret
  3. 使用AppKey调用API提取IP
  4. 在您的应用中使用提取的代理IP

🌐 提取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); });

⚠️ 错误码说明

错误码 说明
0成功
-1账号校验失败,AppKey无效或已过期
-2当前没有可用IP资源
-3网关打开资源失败
-4连接不上资源服务器
-5AppKey参数错误
-6找不到网关
-7服务器校验失败
-8数据传输中断
-9HTTP协议链接地址不匹配
-10套餐余额不足
-11请求频率超限

❓ 常见问题

Q: 如何获取AppKey和AppSecret?

A: 登录控制台后,购买IP套餐即可自动生成AppKey和AppSecret。

Q: IP有效期是多久?

A: 根据您购买的套餐类型,有效期为30秒、1分钟、3分钟、5分钟或10分钟。

Q: 如何实现IP去重?

A: 在请求参数中设置 only=1,同一个AppKey在当天不会返回重复的IP。

Q: 请求频率有限制吗?

A: 为了保证服务质量,单个AppKey每秒最多请求1次。如需更高频率,请联系客服升级套餐。