Oxylabs Documentation
中文
搜索
K

代理列表

基础

您应该从您的专门账户经理或我们的客服部门收到一个代理列表的 URL,它应该看起来像这样:
https://proxy.oxylabs.io/key/a27c5343ce4c4637a85a9297ddf1cace
在您的浏览器(或任何其他首选软件)中打开此 URL。然后,您将被要求输入您的登录凭证(HTTP 基本身份认证):
完成后,您就会获得一个纯文本的代理列表。
如果您有多个列表并希望获取分配给您的账户的所有 IP,则可以使用这个 URL:
https://proxy.oxylabs.io/all
您也可以在您的 URL 末尾包括 ?showCountry?showCity,以获得带有相应位置的 IP。
127.0.0.1:60000
127.0.0.2:60000
127.0.0.3:60000
127.0.0.4:60000

RESTful

显示所有可用代理列表

此端点让您检索属于您的用户的代理列表:
GET https://api.oxylabs.io/v1/proxies/lists

代码示例

cURL
PHP
Python
C#
curl -u username:password "https://api.oxylabs.io/v1/proxies/lists"
<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.oxylabs.io/v1/proxies/lists");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_USERPWD, 'username:password');
$result = curl_exec($curl);
?>
import requests
requests.get('https://api.oxylabs.io/v1/proxies/lists', auth=('username', 'password'))
using System;
using System.Net;
class Example
{
static void Main()
{
var client = new WebClient();
client.Proxy.Credentials = new NetworkCredential("username", "pass");
Console.WriteLine(client.DownloadString("https://api.oxylabs.io/v1/proxies/lists"));
}
}

样例输出

[
{
"uuid": "123e4567-e89b-12d3-a456-426655440000",
"key": "12345678",
"updated_timestamp": "2016-09-28T13:03:50+0300",
"ips_count": 2000,
"href": "http://api.oxylabs.io/v1/proxies/lists/123e4567-e89b-12d3-a456-426655440000"
}
]

检索具体的代理列表

此端点让您检索具体的代理列表:
GET https://api.oxylabs.io/v1/proxies/lists/{uuid}

请求参数

参数
描述
uuid
要检索的代理列表的 uuid

代码示例

cURL
PHP
Python
C#
curl -u username:password "https://api.oxylabs.io/v1/proxies/lists/{uuid}"
<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.oxylabs.io/v1/proxies/lists/{uuid}");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_USERPWD, 'username:password');
?>
import requests
requests.get('https://api.oxylabs.io/v1/proxies/lists/{uuid}', auth=('username', 'password'))
using System;
using System.Net;
class Example
{
static void Main()
{
var client = new WebClient();
client.Proxy.Credentials = new NetworkCredential("username", "pass");
Console.WriteLine(client.DownloadString("https://api.oxylabs.io/v1/proxies/lists/{uuid}"));
}
}

样例输出

[
{
"ip": "127.0.0.1",
"port": "60000",
"country": "BE",
"city": "Brussels",
"created_at": "2022-04-06 13:03:10"
},
{
"ip": "127.0.0.2",
"port": "60000",
"country": "BE",
"city": "Brussels",
"created_at": "2022-04-06 13:03:10"
}
]