IPRoyal Documentation
CN
CN
  • 概述
  • 代理
    • 皇家住宅代理
      • 仪表板
        • 统计数据
        • 配置
          • 自动充值
          • 代理访问
          • 白名单IP
          • 跳过IP
          • 权限管理
        • 订单
        • 子用户
      • 代理
        • 位置
        • 轮换类型
        • 高端池
        • 跳过静态ISP
        • IP白名单
        • 跳过IP
        • 权限管理
        • 协议
        • 提出请求
      • 子用户
      • API
        • 会话
        • 用户
        • 访问
        • 子用户
        • 白名单
        • 跳过IP
      • 域名访问条款
    • 静态住宅代理
      • 仪表板
        • 订单
        • 订单配置
        • 续期订单
      • 使用代理字符串
      • API
        • 用户
        • 产品
        • 订单
        • 代理
    • 数据中心代理
      • 仪表板
        • 订单
        • 订单配置
        • 续期订单
      • 使用代理字符串
      • API
        • 用户
        • 产品
        • 订单
        • 代理
    • 移动代理
      • 仪表板
        • 订单
        • 订单配置
        • 续期订单
      • 使用代理字符串
      • 故障排除
      • API
        • 用户
        • 代理
Powered by GitBook
On this page
  • HTTP/HTTPS
  • SOCKS5
  1. 代理
  2. 移动代理

使用代理字符串

在本节中,我们将展示使用我们创建的代理字符串的实际示例。我们将重点介绍如何设置HTTP/HTTPS和SOCKS5连接,并通过使用各种编程语言的示例进行说明。

我们的运动鞋数据中心代理兼容UDP和TCP连接。

请记住,端口会根据协议(HTTP/SOCKS5)而有所不同。要想在HTTP或SOCKS5代理之间进行选择,请参阅“订单配置”部分中的“代理访问”面板。 订单配置

HTTP/HTTPS

curl -v -x http://gb.4g.iproyal.com:7001 --proxy-user IqcDPwX:Cz6hB219pDaCgEG -L https://ipv4.icanhazip.com
<?php

$url = 'https://ipv4.icanhazip.com';
$proxy = 'gb.4g.iproyal.com:7001';
$proxyAuth = 'IqcDPwX:Cz6hB219pDaCgEG';

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyAuth);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);
curl_close($ch);

echo $response;

?>
const axios = require('axios');

const url = 'https://ipv4.icanhazip.com';
const proxyOptions = {
  host: 'gb.4g.iproyal.com',
  port: 7001,
  auth: {
    username: 'IqcDPwX',
    password: 'Cz6hB219pDaCgEG'
  }
};

axios.get(url, { proxy: proxyOptions })
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('Error:', error);
  });
import requests

url = 'https://ipv4.icanhazip.com'
proxy = 'gb.4g.iproyal.com:7001'
proxy_auth = 'IqcDPwX:Cz6hB219pDaCgEG'
proxies = {
    'http': f'http://{proxy_auth}@{proxy}',
    'https': f'http://{proxy_auth}@{proxy}'
}

response = requests.get(url, proxies=proxies)
print(response.text)

SOCKS5

curl -v --socks5 gb.4g.iproyal.com:3008 --proxy-user IqcDPwX:Cz6hB219pDaCgEG -L https://ipv4.icanhazip.com
<?php

$url = 'https://ipv4.icanhazip.com';
$proxy = 'gb.4g.iproyal.com:3008';
$proxyAuth = 'IqcDPwX:Cz6hB219pDaCgEG';

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyAuth);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);
curl_close($ch);

echo $response;

?>
const axios = require('axios');
const SocksProxyAgent = require('socks-proxy-agent');

const url = 'https://ipv4.icanhazip.com';
const socksProxy = 'socks5://IqcDPwX:Cz6hB219pDaCgEG@gb.4g.iproyal.com:3008';
const agent = new SocksProxyAgent(socksProxy);

axios.get(url, { httpAgent: agent, httpsAgent: agent })
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('Error:', error);
  });
import requests

url = 'https://ipv4.icanhazip.com'
socks5_proxy = 'socks5://IqcDPwX:Cz6hB219pDaCgEG@gb.4g.iproyal.com:3008'
proxies = {
    'http': socks5_proxy,
    'https': socks5_proxy
}

response = requests.get(url, proxies=proxies)
print(response.text)

由于我们硬件的特殊性,我们建议在您需要与软件更好地兼容时选择HTTP协议而不是SOCKS5。虽然这两种协议均会得到支持,而且执行效率很高,但HTTP遇到的问题通常能更快地得到解决。

Previous续期订单Next故障排除

Last updated 1 month ago