访问
获取入口节点
GET
/access/entry-nodes
不同的入口节点有助于确定从您所在国家出发的更快路线。
在几乎所有情况下,您都应该使用 geo.iproyal.com,它将自动确定适合您所在位置的最佳服务器。
請求範例:
curl -X GET https://resi-api.iproyal.com/v1/access/entry-nodes \
-H "Authorization: Bearer <your_api_token>"
<?php
$api_token = '<your_api_token>';
$url = 'https://resi-api.iproyal.com/v1/access/entry-nodes';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPGET, true);
$headers = [
"Authorization: Bearer $api_token"
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
} else {
echo $response;
}
curl_close($ch);
?>
import requests
api_token = '<your_api_token>'
url = 'https://resi-api.iproyal.com/v1/access/entry-nodes'
headers = {
'Authorization': f'Bearer {api_token}'
}
response = requests.get(url, headers=headers)
print(response.text)
const https = require('https');
const apiToken = '<your_api_token>';
const url = 'https://resi-api.iproyal.com/v1/access/entry-nodes';
const options = {
method: 'GET',
headers: {
'Authorization': `Bearer ${apiToken}`
}
};
const req = https.request(url, options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
console.log(data);
});
});
req.on('error', (error) => {
console.error('Error:', error.message);
});
req.end();
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class ApiRequest {
public static void main(String[] args) {
String apiToken = "<your_api_token>";
String urlString = "https://resi-api.iproyal.com/v1/access/entry-nodes";
try {
URL url = new URL(urlString);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Authorization", "Bearer " + apiToken);
int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuilder content = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
content.append(inputLine);
}
in.close();
System.out.println(content.toString());
} else {
System.out.println("GET request failed. Response Code: " + responseCode);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
package main
import (
"io"
"log"
"net/http"
"fmt"
)
const (
apiToken = "<your_api_token>"
entryNodesURL = "https://resi-api.iproyal.com/v1/access/entry-nodes"
)
func main() {
req, err := http.NewRequest(http.MethodGet, entryNodesURL, nil)
if err != nil {
log.Fatal("Error creating request:", err)
}
req.Header.Set("Authorization", "Bearer "+apiToken)
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
log.Fatal("Error making request:", err)
}
defer resp.Body.Close()
responseBody, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal("Error reading response body:", err)
}
fmt.Println(string(responseBody))
}
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
string apiToken = "<your_api_token>";
string url = "https://resi-api.iproyal.com/v1/access/entry-nodes";
using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");
HttpResponseMessage response = await client.GetAsync(url);
string responseText = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseText);
}
}
}
响应示例:
[
{
"dns": "proxy.iproyal.com",
"ips": ["91.239.130.34"],
"ports": [
{
"name": "http|https",
"port": 12321,
"alternative_ports": [
11200,
...
]
},
{
"name": "socks5",
"port": 32325,
"alternative_ports": [
51200,
...
]
}
]
},
{
"dns": "us.proxy.iproyal.com",
"ips": ["23.146.144.102", "23.146.144.102"],
"ports": [
{
"name": "http|https",
"port": 12321,
"alternative_ports": [
11246,
...
]
},
{
"name": "socks5",
"port": 32325,
"alternative_ports": [
51200,
...
]
}
]
},
...
]
获取国家
GET
/access/countries
返回可用于针对特定代理的国家、城市、州和互联网服务提供商(ISP)的列表。它还返回用于每个代理的前缀。有关如何构建代理字符串的更多信息,请参阅我们的“代理”小节。
根据您作为用户进行的一些设置,它将返回不同的结果。
身份验证——提供更大的选项选择。
跳过静态ISP(管理员可激活)——在已验证的身份基础上,包含一个参数,该参数将反映代理的可用性,跳过静态代理。
启用ISP(管理员可激活)——包含每个地区的互联网服务提供商。
显示IP可用性(管理员可激活)——添加一个参数,以显示该地区代理的可用性。
請求範例:
curl -X GET https://resi-api.iproyal.com/v1/access/countries \
-H "Authorization: Bearer <your_api_token>"
<?php
$api_token = '<your_api_token>';
$url = 'https://resi-api.iproyal.com/v1/access/countries';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPGET, true);
$headers = [
"Authorization: Bearer $api_token"
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
} else {
echo $response;
}
curl_close($ch);
?>
import requests
api_token = '<your_api_token>'
url = 'https://resi-api.iproyal.com/v1/access/countries'
headers = {
'Authorization': f'Bearer {api_token}'
}
response = requests.get(url, headers=headers)
print(response.text)
const https = require('https');
const apiToken = '<your_api_token>';
const url = 'https://resi-api.iproyal.com/v1/access/countries';
const options = {
method: 'GET',
headers: {
'Authorization': `Bearer ${apiToken}`
}
};
const req = https.request(url, options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
console.log(data);
});
});
req.on('error', (error) => {
console.error('Error:', error.message);
});
req.end();
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class ApiRequest {
public static void main(String[] args) {
String apiToken = "<your_api_token>";
String urlString = "https://resi-api.iproyal.com/v1/access/countries";
try {
URL url = new URL(urlString);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Authorization", "Bearer " + apiToken);
int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuilder content = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
content.append(inputLine);
}
in.close();
System.out.println(content.toString());
} else {
System.out.println("GET request failed. Response Code: " + responseCode);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
package main
import (
"io"
"log"
"net/http"
"fmt"
)
const (
apiToken = "<your_api_token>"
countriesURL = "https://resi-api.iproyal.com/v1/access/countries"
)
func main() {
req, err := http.NewRequest(http.MethodGet, countriesURL, nil)
if err != nil {
log.Fatal("Error creating request:", err)
}
req.Header.Set("Authorization", "Bearer "+apiToken)
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
log.Fatal("Error making request:", err)
}
defer resp.Body.Close()
responseBody, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal("Error reading response body:", err)
}
fmt.Println(string(responseBody))
}
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
string apiToken = "<your_api_token>";
string url = "https://resi-api.iproyal.com/v1/access/countries";
using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");
HttpResponseMessage response = await client.GetAsync(url);
string responseText = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseText);
}
}
}
响应示例:
{
"prefix": "_country-",
"countries": [
{
"code": "ae",
"name": "United Arab Emirates",
"cities": {
"prefix": "_city-",
"options": [
{
"code": "abudhabi",
"name": "Abu dhabi",
"isps": {
"prefix": "_isp-",
"options": [
{
"code": "emiratesintegratedtelecommunicationscompanypjsc",
"name": "Emirates Integrated Telecommunications Company PJSC",
"ip_availability": "low",
"ip_availability_skip_isp_static": "low"
},
{
"code": "emiratestelecommunicationsgroupcompanyetisalatgrouppjsc",
"name": "Emirates Telecommunications Group Company (Etisalat Group) PJSC",
"ip_availability": "medium",
"ip_availability_skip_isp_static": "medium"
}
]
},
"ip_availability": "medium",
"ip_availability_skip_isp_static": "medium"
},
{
"code": "ajman",
"name": "'ajman",
"isps": {
"prefix": "_isp-",
"options": [
{
"code": "emiratesintegratedtelecommunicationscompanypjsc",
"name": "Emirates Integrated Telecommunications Company PJSC",
"ip_availability": "low",
"ip_availability_skip_isp_static": "low"
},
{
"code": "emiratestelecommunicationsgroupcompanyetisalatgrouppjsc",
"name": "Emirates Telecommunications Group Company (Etisalat Group) PJSC",
"ip_availability": "low",
"ip_availability_skip_isp_static": "low"
}
]
},
"ip_availability": "medium",
"ip_availability_skip_isp_static": "medium"
},
...
]
}
},
...
]
}
获取区域
与 #countries类似,它返回可用的地区,用于选择代理的地区。
GET
/access/regions
請求範例:
curl -X GET https://resi-api.iproyal.com/v1/access/regions \
-H "Authorization: Bearer <your_api_token>"
<?php
$api_token = '<your_api_token>';
$url = 'https://resi-api.iproyal.com/v1/access/regions';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPGET, true);
$headers = [
"Authorization: Bearer $api_token"
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
} else {
echo $response;
}
curl_close($ch);
?>
import requests
api_token = '<your_api_token>'
url = 'https://resi-api.iproyal.com/v1/access/regions'
headers = {
'Authorization': f'Bearer {api_token}'
}
response = requests.get(url, headers=headers)
print(response.text)
const https = require('https');
const apiToken = '<your_api_token>';
const url = 'https://resi-api.iproyal.com/v1/access/regions';
const options = {
method: 'GET',
headers: {
'Authorization': `Bearer ${apiToken}`
}
};
const req = https.request(url, options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
console.log(data);
});
});
req.on('error', (error) => {
console.error('Error:', error.message);
});
req.end();
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class ApiRequest {
public static void main(String[] args) {
String apiToken = "<your_api_token>";
String urlString = "https://resi-api.iproyal.com/v1/access/regions";
try {
URL url = new URL(urlString);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Authorization", "Bearer " + apiToken);
int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuilder content = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
content.append(inputLine);
}
in.close();
System.out.println(content.toString());
} else {
System.out.println("GET request failed. Response Code: " + responseCode);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
package main
import (
"io"
"log"
"net/http"
"fmt"
)
const (
apiToken = "<your_api_token>"
regionsURL = "https://resi-api.iproyal.com/v1/access/regions"
)
func main() {
req, err := http.NewRequest(http.MethodGet, regionsURL, nil)
if err != nil {
log.Fatal("Error creating request:", err)
}
req.Header.Set("Authorization", "Bearer "+apiToken)
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
log.Fatal("Error making request:", err)
}
defer resp.Body.Close()
responseBody, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal("Error reading response body:", err)
}
fmt.Println(string(responseBody))
}
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
string apiToken = "<your_api_token>";
string url = "https://resi-api.iproyal.com/v1/access/regions";
using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");
HttpResponseMessage response = await client.GetAsync(url);
string responseText = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseText);
}
}
}
响应示例:
{
"prefix": "_region-",
"regions": [
{
"code": "africa",
"name": "Africa"
},
{
"code": "arabstates",
"name": "Arab States"
},
{
"code": "asiapacific",
"name": "Asia & Pacific"
},
{
"code": "europe",
"name": "Europe"
},
{
"code": "middleeast",
"name": "Middle east"
},
{
"code": "northamerica",
"name": "North America"
},
{
"code": "southlatinamerica",
"name": "South/Latin America"
}
]
}
获取国家集合
GET
/access/country-sets
与#countries类似,它返回可用国家集合,用于选择代理的地区。
請求範例:
curl -X GET https://resi-api.iproyal.com/v1/access/country-sets \
-H "Authorization: Bearer <your_api_token>"
<?php
$api_token = '<your_api_token>';
$url = 'https://resi-api.iproyal.com/v1/access/country-sets';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPGET, true);
$headers = [
"Authorization: Bearer $api_token"
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
} else {
echo $response;
}
curl_close($ch);
?>
import requests
api_token = '<your_api_token>'
url = 'https://resi-api.iproyal.com/v1/access/country-sets'
headers = {
'Authorization': f'Bearer {api_token}'
}
response = requests.get(url, headers=headers)
print(response.text)
const https = require('https');
const apiToken = '<your_api_token>';
const url = 'https://resi-api.iproyal.com/v1/access/country-sets';
const options = {
method: 'GET',
headers: {
'Authorization': `Bearer ${apiToken}`
}
};
const req = https.request(url, options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
console.log(data);
});
});
req.on('error', (error) => {
console.error('Error:', error.message);
});
req.end();
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class ApiRequest {
public static void main(String[] args) {
String apiToken = "<your_api_token>";
String urlString = "https://resi-api.iproyal.com/v1/access/country-sets";
try {
URL url = new URL(urlString);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Authorization", "Bearer " + apiToken);
int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuilder content = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
content.append(inputLine);
}
in.close();
System.out.println(content.toString());
} else {
System.out.println("GET request failed. Response Code: " + responseCode);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
package main
import (
"io"
"log"
"net/http"
"fmt"
)
const (
apiToken = "<your_api_token>"
countrySetsURL = "https://resi-api.iproyal.com/v1/access/country-sets"
)
func main() {
req, err := http.NewRequest(http.MethodGet, countrySetsURL, nil)
if err != nil {
log.Fatal("Error creating request:", err)
}
req.Header.Set("Authorization", "Bearer "+apiToken)
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
log.Fatal("Error making request:", err)
}
defer resp.Body.Close()
responseBody, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal("Error reading response body:", err)
}
fmt.Println(string(responseBody))
}
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
string apiToken = "<your_api_token>";
string url = "https://resi-api.iproyal.com/v1/access/country-sets";
using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiToken}");
HttpResponseMessage response = await client.GetAsync(url);
string responseText = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseText);
}
}
}
响应示例:
{
"prefix": "_set-",
"countrySets": [
{
"code": "courir",
"name": "COURIR"
},
{
"code": "mesh1",
"name": "MESH 1"
},
{
"code": "mesh2",
"name": "MESH 2"
},
{
"code": "nikeas",
"name": "NIKE ASIA"
},
{
"code": "nikeeu",
"name": "NIKE EU"
},
{
"code": "nikena",
"name": "NIKE US"
},
{
"code": "zalando",
"name": "ZALANDO"
}
]
}
生成代理列表
POST
/access/generate-proxy-list
如果提供了subuser_hash,则不需要用户名和密码,反之亦然——如果提供了用户名和密码,则不需要subuser_hash。
您希望使用的位置需要加上在文档中描述的“前缀”。获取国家
請求範例:
名称 | 类型 | 描述 | 可用选项 |
---|---|---|---|
format | 字符串 | 将返回代理字符串的格式 |
|
hostname | 字符串 | 将要使用的主机名 | |
port | 字符串 | 端口作为协议字符串 |
|
rotation | 字符串 | 将被使用的轮换类型 |
|
subuser_hash | 字符串 | 将要使用的子服务器 | |
location | 字符串 | 将要使用的地区 | |
proxy_count | 整型 | 将返回的代理计数 | |
username | 字符串 | 将要使用的用户名 | |
password | 字符串 | 将要使用的密码 | |
lifetime | 字符串 | 对于粘性会话,这将告知该会话将持续多长时间 |
|
正文参数:
curl -X POST https://resi-api.iproyal.com/v1/access/generate-proxy-list \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <your_api_token>" \
-d '{
"format": "{hostname}:{port}:{username}:{password}",
"hostname": "example.hostname.com",
"port": "http|https",
"rotation": "sticky",
"location": "_country-sg",
"proxy_count": 10,
"subuser_hash": "example_subuser_hash"
}'
<?php
$api_token = '<your_api_token>';
$url = 'https://resi-api.iproyal.com/v1/access/generate-proxy-list';
$data = [
'format' => '{hostname}:{port}:{username}:{password}',
'hostname' => 'example.hostname.com',
'port' => 1234,
'rotation' => 'sticky',
'location' => '_country-sg',
'proxy_count' => 10,
'subuser_hash' => 'example_subuser_hash'
];
$payload = json_encode($data);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
"Authorization: Bearer $api_token"
]);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
$response = curl_exec($ch);