im@markvi.eu

To use a SOCKS5 proxy with cURL, you can spec­i­fy the proxy using the -x or --proxy option. The for­mat for spec­i­fy­ing a SOCKS5 proxy is socks5h://[proxy_address]:[port].

Here’s an exam­ple of how you can use a SOCKS5 proxy with cURL to make a GET request to a website:

curl -x socks5h://127.0.0.1:10162 http://v4v6.ipv6-test.com/api/myip.php

In this exam­ple, 127.0.0.1 is the address of the proxy serv­er and 10162 is the port number.

You can also use the --socks5 options which is not rec­om­mend­ed because it’s not going to be sup­port­ed on future versions

curl --socks5 127.0.0.1:10162 http://v4v6.ipv6-test.com/api/myip.php

You can also use the ‑U or —user to pro­vide user­name and pass­word for SOCKS proxy authentication.

curl -x socks5h://user:password@127.0.0.1:10162 http://v4v6.ipv6-test.com/api/myip.php

Con­clu­sion #

To use a SOCKS5 proxy with cURL, you can spec­i­fy the proxy using the -x or --proxy option in the for­mat socks5h://[proxy_address]:[port] or --socks5 option. Addi­tion­al­ly, you can pro­vide a user­name and pass­word for SOCKS proxy authen­ti­ca­tion using -U or --user options. You can use these options to make GET or POST requests through a SOCKS5 proxy.

Please remem­ber that --socks5 is not rec­om­mend­ed as it may not be sup­port­ed in future ver­sions, make sure your curl ver­sion sup­port SOCKS5 proxy type.

Similar Articles