> ## Documentation Index
> Fetch the complete documentation index at: https://help.decodo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 快速入门

> 数据中心按流量付费代理快速入门

<Tip>
  ### Decodo代理使用端点

  * 端点就像IP池的网关。
  * 当您连接到端点时，您的流量会**自动**通过Decodo IP池中的随机IP地址进行路由。
</Tip>

* 数据中心代理使用以下端点和端口进行随机请求：

```text theme={null}
dc.decodo.com:10000
```

* 以下是各种编程语言的一些基本请求示例：

<CodeGroup>
  ```shellscript cURL theme={null}
  curl -U "USERNAME:PASSWORD" -x "dc.decodo.com:10000" "https://ip.decodo.com/json"
  ```

  ```python Python theme={null}
  import requests
  url = 'https://ip.decodo.com/json'
  username = 'USERNAME'
  password = 'PASSWORD'
  proxy = f"http://{username}:{password}@dc.decodo.com:10000"
  result = requests.get(url, proxies = {
      'http': proxy,
      'https': proxy
  })
  print(result.text)
  ```

  ```javascript Node theme={null}
  const axios = require('axios');
  const { HttpsProxyAgent } = require('https-proxy-agent');

  const url = 'https://ip.decodo.com/json';
  const proxyAgent = new HttpsProxyAgent(
    'http://username:password@dc.decodo.com:10000');

  axios
    .get(url, {
      httpsAgent: proxyAgent,
    })
    .then((response) => {
      console.log(response.data);
    });
  ```

  ```php PHP theme={null}
  <?php

        $url = 'ip.decodo.com/json';
        $proxy = 'dc.decodo.com';
        $port = 10000;
        $user = 'username';
        $psw = 'password';

        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        
        curl_setopt($ch, CURLOPT_PROXY, "$proxy:$port");
        curl_setopt($ch, CURLOPT_PROXYUSERPWD, "$user:$psw");
        $result = curl_exec($ch);
        curl_close($ch);

        if ($result) {
          echo $result . PHP_EOL;
        }
  ```

  ```go Go theme={null}
  package main

  import (
      "log"
      "net/http"
      "net/url"
  )

     func main() {
       proxyUrl, err := url.Parse("http://username:password@dc.decodo.com:10000")
       if err != nil {
         log.Fatalln(err)
       }

       client := &http.Client{
         Transport: &http.Transport{Proxy: http.ProxyURL(proxyUrl)},
       }
       req, err := http.NewRequest("GET", "https://ip.decodo.com/json", nil)
       if err != nil {
         log.Println(err)
       }

       res, err := client.Do(req)
       log.Println(res)

       if err != nil {
         log.Println(err)
       }
     }
  ```

  ```java Java theme={null}
  import java.net.*;
  import java.io.*;
  import java.util.Scanner;

  public class ProxyTest
  {
     public static void main(String[] args) throws Exception
     {
    	InetSocketAddress proxyAddress = new InetSocketAddress("dc.decodo.com", 10000); // Set proxy IP/port.
    	Proxy proxy = new Proxy(Proxy.Type.HTTP, proxyAddress);
    	URL url = new URI("https://ip.decodo.com/").toURL(); //enter target URL
    	Authenticator authenticator = new Authenticator() {
       	public PasswordAuthentication getPasswordAuthentication() {
          	return (new PasswordAuthentication("username","password".toCharArray())); //enter credentials
       	}
    	};

    	Authenticator.setDefault(authenticator);
     URLConnection urlConnection = url.openConnection(proxy);

  //Scanner to view output

  Scanner scanner = new Scanner(urlConnection.getInputStream());
     System.out.println(scanner.nextLine());
     scanner.close();

     }
  }
  ```
</CodeGroup>

<Tip>
  ### 控制您的连接

  * 您可以通过添加参数来控制IP选择和位置，使其更加具体。
  * 继续阅读以获取有关指定和生成更多示例的分步演练，或查看我们的[**高级参数**](https://help.decodo.com/docs/cn/datacenter-pay-per-gb-proxy-advanced-parameters)文章以获得更深入的了解。
</Tip>

***

## 身份验证

1. 首先，导航到仪表板上的[**数据中心 → 数据中心按流量付费 → 代理设置**](https://dashboard.decodo.com/shared-dc-gb-proxies/proxy-setup)页面，查找身份验证部分。
   * 您会看到您的第一个代理用户和密码已自动创建。
2. 接下来，选择您的代理**身份验证方法**。
   * 这可以是您的**白名单IP**地址或您的**代理用户**之一

<img src="https://mintcdn.com/decodo/HeowWjVaMvMCJRIK/images/docs/5c238c61f8e90042aba945a638a2f181acc98fdc8af65d4fbfb78e2c05947c7e-Group_427323259.png?fit=max&auto=format&n=HeowWjVaMvMCJRIK&q=85&s=b742ec283beee5473730e470583481df" className="mx-auto" width="3448" height="1152" data-path="images/docs/5c238c61f8e90042aba945a638a2f181acc98fdc8af65d4fbfb78e2c05947c7e-Group_427323259.png" />

<Tip>
  ### 其他身份验证选项

  1. 您可以通过点击密码来**复制**它
  2. 要查看密码，请点击**眼睛**图标。
  3. 您可以通过点击**箭头图标**并选择**确认**来生成新密码。
  4. 在这里，您还可以查看每个代理用户的**已用流量**并**添加流量限制**，或检查白名单IP的已用流量总和。

  * 您可以在**身份验证**选项卡中进一步管理您的凭据。有关更多详细信息，请查看[**身份验证方法**](https://help.decodo.com/docs/cn/datacenter-pay-per-gb-proxy-authentication-methods)文章。
</Tip>

<img src="https://mintcdn.com/decodo/eRLuBYAbadfvmqDE/images/docs/41cddf32f5e959d3ced24e1c263cade920015032d6820e0c8ea3b63970a33eaf-Group_427323222.png?fit=max&auto=format&n=eRLuBYAbadfvmqDE&q=85&s=df39dae359b8cb5285c6f5aa7e343bab" style={{ width:"46%" }} className="mx-auto" width="1600" height="380" data-path="images/docs/41cddf32f5e959d3ced24e1c263cade920015032d6820e0c8ea3b63970a33eaf-Group_427323222.png" />

## 代理设置

在仪表板的数据中心按流量付费代理设置部分，选择各种参数将生成您可以轻松复制到应用程序、工具或代码中的示例。

1. 在[**数据中心 → 数据中心按流量付费 → 代理设置**](https://dashboard.decodo.com/shared-dc-gb-proxies/proxy-setup)页面上，在身份验证方法下方找到参数选择部分。

<img src="https://mintcdn.com/decodo/7Hj3tfc-1rGMirwk/images/docs/c0372e3180098ecb7dc37e5a12b53f919465376c839524ae217d4a00f6e3549d-Group_427323253.png?fit=max&auto=format&n=7Hj3tfc-1rGMirwk&q=85&s=fcd49aa7999d576c50d47b78ecce23cc" className="mx-auto" width="3448" height="456" data-path="images/docs/c0372e3180098ecb7dc37e5a12b53f919465376c839524ae217d4a00f6e3549d-Group_427323253.png" />

### 位置

2. 首先，选择代理的[**位置**](https://help.decodo.com/docs/cn/datacenter-pay-per-gb-proxy-locations)。

<Note>
  ### 基于IP的白名单和位置选择

  * 对于数据中心按流量付费代理，只有在使用`user:pass`身份验证方法时才能指定位置。否则，使用白名单IP只能选择`random`位置。
</Note>

<img src="https://mintcdn.com/decodo/HeowWjVaMvMCJRIK/images/docs/52f5ebc9473c2f55ae1b1e7c8954ef0e7201481fc6d504eb853f889e6d8281ce-Group_427323255.png?fit=max&auto=format&n=HeowWjVaMvMCJRIK&q=85&s=09f5a9be09f41fd246475f11bc1b45fd" style={{ width:"46%" }} className="mx-auto" width="1600" height="2152" data-path="images/docs/52f5ebc9473c2f55ae1b1e7c8954ef0e7201481fc6d504eb853f889e6d8281ce-Group_427323255.png" />

### 会话类型

3. 然后，选择您首选的[**会话类型**](https://help.decodo.com/docs/cn/datacenter-pay-per-gb-proxy-session-types)，**轮换**或**静态**。

<Note>
  ### 会话端口

  * **静态** – 端口`10001`-`63000`提供静态IP地址，该地址将保持不变，直到您决定更改它或会话结束。目前，您可以在仪表板中生成最多`16000`个静态端口（`10001`-`26000`）；但是，您可以手动设置最多`63000`个。
  * **轮换** – 端口`10000`在您发出的每个请求上轮换IP地址。
</Note>

<img src="https://mintcdn.com/decodo/7Hj3tfc-1rGMirwk/images/docs/c58a99f10ba89349dfb3a42d4fd897672e4b797393fc94aeb9bdaf060d2f4ab0-Group_427323232.png?fit=max&auto=format&n=7Hj3tfc-1rGMirwk&q=85&s=7d15f835b10e4e2782a5623412f9d06d" style={{ width:"46%" }} className="mx-auto" width="1600" height="760" data-path="images/docs/c58a99f10ba89349dfb3a42d4fd897672e4b797393fc94aeb9bdaf060d2f4ab0-Group_427323232.png" />

### 协议

4. 最后，选择[**协议**](https://help.decodo.com/docs/cn/datacenter-pay-per-gb-proxy-protocols)格式。可用选项包括`Endpoint:port`、`HTTP`、`HTTPS`和`SOCKS5`。

<img src="https://mintcdn.com/decodo/ZzFFt4k1AMcE-z1r/images/docs/848715f9e5b89d392262d83e3c80798baa1654a2c7b4991100f84f5a9efa17d0-Group_427323211.png?fit=max&auto=format&n=ZzFFt4k1AMcE-z1r&q=85&s=daf6e3e2921cadc01e6e83b106967102" style={{ width:"46%" }} className="mx-auto" width="1600" height="1604" data-path="images/docs/848715f9e5b89d392262d83e3c80798baa1654a2c7b4991100f84f5a9efa17d0-Group_427323211.png" />

## 代理列表示例

在代理设置部分完成设置后，您将看到根据您的选择生成的端点和端口的**代理列表**。

1. 只需将其**复制**到剪贴板，或**下载**创建的代理列表的`.csv`或`.txt`文件。
2. 或者，**复制**生成参数的单个元素，例如**代理地址**、**端口**、**用户名**和**密码**，或复制整个示例字符串。

<img src="https://mintcdn.com/decodo/7Hj3tfc-1rGMirwk/images/docs/b62e370b1877acbf18cd5bd56442fe25315b6fc98672c8f7c00b276b960a1dda-Group_427323256.png?fit=max&auto=format&n=7Hj3tfc-1rGMirwk&q=85&s=78baa547f35067d818f62d3ec6c85e90" alt="" width="3448" height="1472" data-path="images/docs/b62e370b1877acbf18cd5bd56442fe25315b6fc98672c8f7c00b276b960a1dda-Group_427323256.png" />

<Tip>
  ### 端点列表控制

  1. 您可以设置生成的端点**数量**。
  2. 以及您希望**每页**显示多少个（`10`、`25`、`50`或`100`）。
  3. 通过点击**眼睛**图标隐藏您的密码。这不会影响复制和粘贴功能。
  4. 点击右上角**布局**下的**切换视图**以显示整个参数字符串。
</Tip>

<img src="https://mintcdn.com/decodo/ZzFFt4k1AMcE-z1r/images/docs/99da778357fbb69ed6b2b0cfac61093f056ed4583b44021eb1c2bfe2c619273d-Group_427323257.png?fit=max&auto=format&n=ZzFFt4k1AMcE-z1r&q=85&s=16d9e419fcbba28c085d79d671ed098f" alt="" width="3448" height="2124" data-path="images/docs/99da778357fbb69ed6b2b0cfac61093f056ed4583b44021eb1c2bfe2c619273d-Group_427323257.png" />

## 代码示例

在项目中使用代理之前，确认代理是否正常运行非常重要。根据您之前在代理设置仪表板底部的选择生成的**代码示例**允许您快速测试代理是否正确连接并显示您的新IP地址。

1. 您可以选择任何可用的语言：`cURL`、`Python`、`NodeJS`、`PHP`或`GO`。
2. 通过点击右下角的**复制**来复制预配置的代码示例。
3. 将代码粘贴并在您的环境中运行。
4. 响应将显示代理IP地址和位置信息，确认您的代理正常工作。

* 如果您在响应中看到代理的IP地址（而不是您的实际IP），恭喜！您的代理已成功配置并准备使用。

<img src="https://mintcdn.com/decodo/ZzFFt4k1AMcE-z1r/images/docs/99aa47261c0953d98745e5da91251a02f91e6baa58b9c9f61553ccd375ce5a49-Group_427323258.png?fit=max&auto=format&n=ZzFFt4k1AMcE-z1r&q=85&s=6787f16b2fd5f1dba1c35210a2ca13c6" alt="" width="3448" height="1248" data-path="images/docs/99aa47261c0953d98745e5da91251a02f91e6baa58b9c9f61553ccd375ce5a49-Group_427323258.png" />

## 集成指南

生成端点和端口后，您可以将它们应用于任何应用程序或工具，立即开始使用代理。

<Note>
  ### Decodo工具

  * 或者，您可以使用专用的Decodo工具 — 适用于[**Chrome**](https://help.decodo.com/docs/cn/decodo-chrome-extension#/)和[**Firefox**](https://help.decodo.com/docs/cn/decodo-firefox-extension#/)的**Decodo扩展**。
</Note>

<Note>
  ### 集成指南

  * 在[**集成概述**](https://help.decodo.com/docs/cn/proxy-integrations-overview)部分查看最受欢迎的第三方工具指南。
</Note>

<Note>
  ### GitHub

  * 有关任何**高级代码示例**和**中间件**，请访问我们的[**GitHub**](https://github.com/decodo/decodo)页面。
</Note>

## 统计

要跟踪数据中心按流量付费代理的使用情况，请导航到[**数据中心 → 数据中心按流量付费 → 使用统计**](https://dashboard.decodo.com/shared-dc-gb-proxies/statistics)部分。

1. 在这里，您可以查看按以下方式排序的**流量**或**请求**使用情况的**图表**：**用户**、**目标**，并选择**时间段**。
2. 以`.CSV`、`.TXT`或`.JSON`格式导出**原始**或**表格数据**。

* 所有日期均为`UTC`。流量历史记录最多限制为`180`天。

<img src="https://mintcdn.com/decodo/IsWPiMoisao6W8vC/images/docs/fa223eb1552e948c23eb6c72d50d2a0b549e3c18e1dcd53be7a92bf3697454ea-Group_427323613_1.png?fit=max&auto=format&n=IsWPiMoisao6W8vC&q=85&s=cb51866f6edcd2403cac4d6ca5226bf5" alt="" width="3796" height="3360" data-path="images/docs/fa223eb1552e948c23eb6c72d50d2a0b549e3c18e1dcd53be7a92bf3697454ea-Group_427323613_1.png" />

<Note>
  ### 热门目标、国家、用户和IP

  * 在下方，您可以在专用部分中看到更详细的信息：
    * **热门目标**：编号、目标、流量、请求。
    * **热门国家**：国家、流量、请求。
    * **热门用户**：用户、流量、请求。
    * **热门IP**：编号、IP、流量、请求。
</Note>

<Note>
  [**在这里**](https://help.decodo.com/docs/cn/datacenter-pay-per-gb-proxy-statistics)您可以找到对**数据中心按流量付费使用统计**页面的更全面了解。
</Note>

## 故障排除

如果您遇到任何问题，请参阅我们的[**故障排除**](https://help.decodo.com/docs/cn/proxy-troubleshooting#/)部分或直接联系我们的支持团队，该团队**全天候**可用。

***

<Columns cols={2}>
  <Card title="支持" href="https://direct.lc.chat/12092754" cta="让我们聊聊！">
    需要帮助或只是想打个招呼？我们的支持团队全天候为您服务。 \
    您也可以随时通过电子邮件 [support@decodo.com](mailto:support@decodo.com) 联系我们。
  </Card>

  <Card title="反馈" href="mailto:feedback@decodo.com" cta="分享反馈">
    找不到您要找的内容？请求一篇文章！ \
    有反馈意见？分享您对我们如何改进的想法。
  </Card>
</Columns>
