Making Requests
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).
HTTP/HTTPS
curl -v -x http://username123:[email protected]:12321 -L https://ipv4.icanhazip.com<?php
$url = 'https://ipv4.icanhazip.com';
$proxy = 'geo.iproyal.com:12321';
$proxyAuth = 'username123:password321_country-us_state-california';
$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;
?>SOCKS5
curl -v -x socks5://username123:[email protected]:32325 -L https://ipv4.icanhazip.com<?php
$url = 'https://ipv4.icanhazip.com';
$proxy = 'geo.iproyal.com:32325';
$proxyAuth = 'username123:password321_country-us_state-california';
$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;
?>Last updated
Was this helpful?