cURL is a command line tool for sending and receiving data using the URL. When you enter a URL that blocked for your location or you want to hide your IP address, you need to connect proxy for cURL. Next, let’s learn how to use cURL with proxy.
cURL official website download URL: https://curl.se/download.html
cURL supports Windows, Linux, macOS, and here I use Windows-64bit.
a. Right-click this PC, click "Properties".
b. Enter "Advanced system settings".
c. Enter "Advanced", click "Environment Variables".
d. Add a new user variable.
-Click "New"
-Enter new user variable name: CURL_HOME
-Enter variable value: enter the CURL bin file installation directory, here is D:\Software\curl-8.0.1_7-win64-mingw\bin
-Click "OK" to save.
e. Edit system variable path.
-Select the Path variable
-Click "Edit"
-Click "New"
-Enter "%CURL_HOME%\I386"
-Click "OK" to save.
On the computer keyboard, press "Windows" and "R" at the same time to open "Run" box.
Then enter "cmd", and click "OK" to open [Command Prompt].
Enter "curl --version" to check the installation status.
If some curl information appears, that means the CURL’s installation has been successful.
This is cURL command with proxy:
-x, --proxy [protocol://]host[:port]
Here I use "https:ipinfo.io" to test proxy IP address.
We can use curl -x
or curl --proxy
to set proxy.
For example: the following two CURL commands is the same.
curl -x "http://username:password@ip:port" "https://ipinfo.io"
or
curl --proxy "http://username:password@ip:port" "https://ipinfo.io"
cURL default proxy protocol type is HTTP.
For example: the following two cURL commands is the same.
curl -x "http://username:password@ip:port" "https://ipinfo.io"
or
curl -x "username:password@ip:port" "https://ipinfo.io"
If you want to ignore or bypass proxy, use cURL noproxy command:
curl --noproxy "*" "https://ipinfo.io"
Here are some cURL commands to connect YiLuProxy different types of IPs.
The following content is cURL with proxy example, including set cURL HTTP proxy and cURL Socks5 proxy. Here I use YiLu Proxy as cURL proxy, and it supports Socks5 and HTTP protocols.
a. On the YiLu Proxy [Residential IPs] or [Pro Mobile IP] tab;
b. Select a YiLu Proxy IP type: dynamic rotating residential IP or datacenter IP, mobile IP, or Pro residential IP;
c. Select the [username:password@IP:port] format;
d. Set the number of generating IPs;
e. Select a country, state, and city;
f. Refresh;
g. Right-click an IP;
h. Copy IP and Port;
i. Enter the curl proxy command; press Enter.
During using the proxy forward port, YiLuProxy client must be running. For local port forwarding detailed tutorial, please view https://yilu.us/configuration/yilu-proxy-ip-use-tutorial.
The article is from https://yilu.us/integration/how-to-use-curl-with-proxy