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.
Our Datacenter proxies are compatible with both UDP and TCP connections.
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 'Formatted Proxy List' panel within the 'Order Configuration' section.
Order Configuration
HTTP/HTTPS
cURL PHP JS Python
Copy curl -v -x 45.12.106.20:12323:1a725103c093:d510a22638 -L https://ipv4.icanhazip.com
Copy <? php
$url = 'https://ipv4.icanhazip.com' ;
$proxy = '45.12.106.20:12323' ;
$proxyAuth = '1a725103c093:d510a22638' ;
$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;
?>
Copy const axios = require ( 'axios' );
const url = 'https://ipv4.icanhazip.com' ;
const proxyOptions = {
host : '45.12.106.20' ,
port : 12323 ,
auth : {
username : '1a725103c093' ,
password : 'd510a22638'
}
};
axios .get (url , { proxy : proxyOptions })
.then (response => {
console .log ( response .data);
})
.catch (error => {
console .error ( 'Error:' , error);
});
Copy import requests
url = 'https://ipv4.icanhazip.com'
proxy = '45.12.106.20:12323'
proxy_auth = '1a725103c093:d510a22638'
proxies = {
'http' : f 'http:// { proxy_auth } @ { proxy } ' ,
'https' : f 'http:// { proxy_auth } @ { proxy } '
}
response = requests . get (url, proxies = proxies)
print (response.text)
SOCKS5
cURL PHP JS Python
Copy curl -v --socks5 45.12.106.20:12324 --proxy-user 1a725103c093:d510a22638 -L https://ipv4.icanhazip.com
Copy <? php
$url = 'https://ipv4.icanhazip.com' ;
$proxy = '45.12.106.20:12324' ;
$proxyAuth = '1a725103c093:d510a22638' ;
$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;
?>
Copy const axios = require ( 'axios' );
const SocksProxyAgent = require ( 'socks-proxy-agent' );
const url = 'https://ipv4.icanhazip.com' ;
const socksProxy = 'socks5://1a725103c093:d510a22638@45.12.106.20:12324' ;
const agent = new SocksProxyAgent (socksProxy);
axios .get (url , { httpAgent : agent , httpsAgent : agent })
.then (response => {
console .log ( response .data);
})
.catch (error => {
console .error ( 'Error:' , error);
});
Copy import requests
url = 'https://ipv4.icanhazip.com'
socks5_proxy = 'socks5://1a725103c093:d510a22638@45.12.106.20:12324'
proxies = {
'http' : socks5_proxy ,
'https' : socks5_proxy
}
response = requests . get (url, proxies = proxies)
print (response.text)
Last updated 9 months ago