How to Hide Your IP with Proxy Servers Using Linux curl
This guide explains proxy server types, how to configure HTTP and SOCKS proxies with Linux curl—including authentication options—and provides step‑by‑step examples and testing methods to evaluate proxy anonymity levels.
Proxy Server Types
Proxy servers sit between a browser and an HTTP server, forwarding requests. The main supported protocols are HTTP(S) and SOCKS. HTTP proxies are divided into three categories: transparent (the server sees the original IP), anonymous (the server knows a proxy is used but not the original IP), and high‑anonymous (the server cannot detect a proxy). SOCKS proxies include SOCKS4, SOCKS4A, and SOCKS5, which support TCP, UDP, server‑side DNS resolution, multiple authentication methods, and IPv6.
curl Proxy Options on Linux
The curl command can set proxies using -x host:port or --proxy protocol://[user:pwd@]host[:port]. Supported protocols are http_proxy, HTTPS_PROXY, socks4, socks4a, and socks5. Authentication methods can be specified with flags such as --proxy-basic, --proxy-ntlm, --proxy-negotiate, and --proxy-anyauth. Username and password can be provided via -U user:password or --proxy-user user:password.
Example: Setting an HTTP Proxy
curl -x 113.185.19.192:80 http://example.com/test.phpcurl --proxy 113.185.19.192:80 http://example.com/test.phpcurl -x http_proxy://user:[email protected]:80 http://example.com/test.phpExample: Setting a SOCKS5 Proxy
curl --socks5 122.192.32.76:7280 http://example.com/test.phpcurl -x socks5://user:[email protected]:7280 http://example.com/test.phpTesting Proxy Anonymity
Create a test.php file that outputs selected $_SERVER variables. Example PHP code:
<?php
$array = array(
'HTTP_USER_AGENT',
'HTTP_HOST',
'HTTP_ACCEPT',
'PATH',
'SERVER_SIGNATURE',
'SERVER_SOFTWARE',
'SERVER_NAME',
'SERVER_ADDR',
'SERVER_PORT',
'DOCUMENT_ROOT',
'SERVER_ADMIN',
'SCRIPT_FILENAME',
'REMOTE_PORT',
'GATEWAY_INTERFACE',
'SERVER_PROTOCOL',
'REQUEST_METHOD',
'QUERY_STRING',
'REQUEST_URI',
'SCRIPT_NAME',
'REQUEST_TIME',
'PHP_SELF'
);
$srv = $_SERVER;
foreach ($array as $name) {
unset($srv[$name]);
}
print_r($srv);
?>Access the script without a proxy, with a transparent proxy, an anonymous proxy, a high‑anonymous proxy, and a SOCKS5 proxy. Observe the output:
Without proxy: REMOTE_ADDR shows the client’s real IP.
Transparent proxy: REMOTE_ADDR shows the proxy IP, and headers like HTTP_X_FORWARDED_FOR and HTTP_VIA reveal the original IP and proxy usage.
Anonymous proxy: REMOTE_ADDR shows the proxy IP, but no original IP header; the presence of HTTP_PROXY_CONNECTION indicates proxy usage.
High‑anonymous proxy: Only REMOTE_ADDR shows the proxy IP; no additional headers expose proxy usage.
SOCKS5 proxy: Similar to high‑anonymous behavior, showing only the proxy IP.
These results help determine the anonymity level of each proxy type.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
