It is a comprehensive guide about cURL. It is open-source software developed by Daniel Stenberg in 1996. In this tutorial, we will focus on only features related to how to use the proxy servers with this cUrl program.
This guide will brief you curl proxies integration in detailed. Although, you can use the proxies in other ways like integrating into Chrome ,Firefox using our proxy manager or Foxy proxy.
What is cURL?
The command line program can be used in any operating system. It is designed to be used for data transfer and it’s free-to-use software was developed in 1996. This cURL client provides you a libcurl which you can integrate into your own scripts, desktop, web and mobile applications. It has support for all major protocols available like HTTP,HTTPS,Socks ,FTP,SFTP, PUT, SCP, POP, LDAP, Gopher and much more.
How to install cUrl
Most operating systems like Mac, Windows 10, and Linux have already pre-installed this cURL software. For install or update use below commands.
Linux debian distros:
sudo apt install curl
yum install curl
Check the download page below.
You can download the binary file or source code and compile it yourself. Select the file you want to download from the official link below.
You can get the docker version as well.
Example cURL commands:
It will show you the content of Facebook in the terminal.
Get a web page from the ipv6 URL:
Use this command to get the help for any argument cURL supports:
Use this man command to get the manual with detailed explanation
How to use HTTP/HTTPS Proxies in the cURL Command line
Here we use a couple of flags with cURL to make the HTTP/HTTPS proxies work with it, And we can browse the URL.
Here is the syntax for cURL for HTTP/HTTPS:
curl -x "username:password@hostip:port" "replace_your_webpage_url_here"
Flags to use:
-x for the proxy server define or use –proxy
-k small k used to browse the insecure SSL URL
-L used to follow the redirections in the URL
-i use it to get the header info of the URL
-v verbose use to display that header information
Examples are here:
curl -x “http://proxy-hub:firstname.lastname@example.org:7777” “https://ip.seeip.org/jsonip” curl –proxy “http://proxy-hub:email@example.com:7777” “https://ip.seeip.org/jsonip” curl –proxy “http://proxy-hub:firstname.lastname@example.org:7777” “https://www.wikipedia.org/” curl –proxy “http://proxy-hub:email@example.com:7777” “https://www.wikipedia.org/” -iL -v curl –proxy “http://proxy-hub:firstname.lastname@example.org:7777” “https://www.wikipedia.org/” -k
Now, Let’s show you an example that shows TCP protocol for the HTTP/HTTPS proxies:
How to use Socks4 and Socks 5 in the cURL Command line
Socks are best to transfer data faster over UDP protocol.
cURL lib supports Socks4 and Socks5 proxies versions.
The syntax for cURL socks4/Socks5:
Remove the username and password for the IP authorized Socks or Public free proxies
curl –socks5 “username:password@hostip:port” “replace_your_webpage_url_here” curl –socks4 “username:password@hostip:port” “replace_your_webpage_url_here”
To validate it, use the Socks protocol. We use -i flag to get the header information.
-v to display the info of protocol use.
How to Configure proxy in an environment variable for cURL
Setting up the proxy in your environment will not require you to place the proxy on every curl request you make via the command line interface.
It works for Linux and Mac operating systems. Follow this method to set http_proxy or https_proxy in the env variable.
Run these commands in your terminal
export http_proxy=”http://username:password@hostip:port” export https_proxy=”https://username:password@hostip:port” export socks4=”username:password@hostip:port” export socks5=”username:password@hostip:port”
Now, Run the command it will not require the proxy.
For windows configuration for curl, follow this guide.
Bypass Environmental variable Proxy and request the URL in cURL
This sets the proxy on global settings, and if you want to make some requests without the proxy from the environment variable. You can make the call with this flag –no-proxy
curl --noproxy "*" "https://ip.seeip.org/jsonip"
It will make the request use your default network IP.
Unset the Proxy in Env
Remove the proxy from the environment by these commands:
unset http_proxy unset https_proxy unset socks5_proxy unset socks4_proxy
cURL is one of the most advanced and mature open-source data transmission software. We don’t need to reinvent the wheel because this library works on all primary operating systems and is integrated with any application you want. For any query related to this integration guide of curl, feel free to ask our team, and we can provide you with the proxies that work with curl. Email us from here and live support.