IPRoyal Documentation
EN
EN
  • Overview
  • PROXIES
    • Residential
      • Dashboard
        • Statistics
        • Configuration
          • Automatic Top-Up
          • Proxy Access
          • Whitelisting IPs
          • IP Skipping
          • Allowances
        • Orders
        • Subscription
        • Sub-Users
      • Proxy
        • Location
        • Rotation
        • High-End Pool
        • Skipping Static ISP
        • IP Whitelisting
        • IP Skipping
        • Allowances
        • Protocols
        • Making Requests
      • Sub-Users
      • API
        • Sessions
        • User
        • Access
        • Sub-Users
        • Whitelists
        • IP Skipping
      • Domain Access Terms
    • ISP (Static Residential)
      • Dashboard
        • Orders
        • Order Configuration
        • Extending an Order
      • Using Proxy Strings
      • API
        • User
        • Products
        • Orders
        • Proxies
    • Datacenter
      • Dashboard
        • Orders
        • Order Configuration
        • Extending an Order
      • Using Proxy Strings
      • API
        • User
        • Products
        • Orders
        • Proxies
    • Mobile
      • Dashboard
        • Orders
        • Order Configuration
        • Extending an Order
      • Using Proxy Strings
      • Troubleshooting
      • API
        • User
        • Proxies
  • Dashboard
    • User Management
Powered by GitBook
On this page
  • HTTP/HTTPS
  • SOCKS5
Export as PDF
  1. PROXIES
  2. Mobile

Using Proxy Strings

In this section, we'll show practical examples of using the proxy string we've created. We'll focus on setting up HTTP/HTTPS and SOCKS5 connections, illustrated through examples in various programming languages.

Keep in mind that the ports will differ depending on the protocol (HTTP/SOCKS5). To choose between HTTP or SOCKS5 proxies, please refer to the 'Proxy access' panel within the 'Order Configuration' section. Order Configuration

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)

We suggest opting for the HTTP protocol instead of SOCKS5 when compatible with your software, due to the particularities of our hardware. While both protocols are supported and perform efficiently, issues encountered with HTTP are typically resolved more swiftly.

PreviousExtending an OrderNextTroubleshooting

Last updated 1 month ago