Published Time:
26/10/2024
Number of views :
--
Reading time :
1 min read
cURL, the full name of which is Client URL, is a well-known Unix-type tool that works in command line mode and uses URL syntax to transfer data and files. It is often used to set up network proxies and supports HTTP, HTTPS, FTP, SCP, and cURL.
First, check if your local machine has installed the curl command-line tool.
The cURL command line is provided with Windows 10, but the official version starts from version 1080. Use the following command to check if you have installed it.
curl --version
How to Set Proxy Command Line Parameters in cURL
Open the terminal, enter the following command and press Enter:
curl --help
The following are common examples of setting up proxies
Example 1: Obtain a simple webpage through curl
curl www.ipinfo.io
Example 2: By adding options after curl, you can track the connection information of the URL, -v, --verbose
Domain name interpretation process: We can get the current IP address and port
Request header information: Contains the current protocol and the protocol request method used. (HTTP/GET)
Response header information: Contains status code (200), content format (text/html), content length, etc.
curl -v www.ipinfo.io
Example 3: Add the -i option after curl to include the response header information. -i, --include
curl -i www.ipinfo.io
Example 4: By adding the -I (uppercase I) option after curl, only the returned header information will be displayed
curl -I www.info.io
Example 5: By adding the -u (lowercase u) option after curl, you can access and obtain user information with authentication.
curl -u username:password https://127.0.01/
Example 6: By adding the -d (lowercase d) option after curl, you can request a connection with parameters
curl -d 'user=1&age=2' https://127.0.01/
Example 7: By adding the -x (lowercase x) option after curl, you can specify the request method. The commonly used request methods using URL are: GET, PUT, POST, and DELETE.
curl -xGET www.ipinfo.io
curl -xPost www.ipinfo.io
curl -xPut www.ipinfo.io
curl -xDelete www.ipinfo.io
Using a proxy with cURL
Required elements for curl with proxy:
Proxy server address, port, protocol, username, password
Please use User&Pass Auth to obtain>>
Assume that the server port is 127.0.0.1 and port 1111
curl "https://www.ipinfo.io"
Use this website to get your current IP address information.
curl -x"https://[email protected]:1111""https://www.Ipinfo.io"
Apply your current proxy information to the above code and use this URL to detect your proxy information.
In addition to -x, you can also use -proxy to provide detailed proxy information.
curl -x "https://[email protected]:1111""https://www.ipinfo.io"
curl -proxy "https://[email protected]:1111""https://www.ipinfo.io"
The default proxy protocol for cURL is HTTP. If you do not specify a proxy protocol, information is obtained using the HTTP protocol.
If you want to use curl through a proxy running the HTTPS protocol, you can specify curl to use the HTTPS protocol by setting the proxy address to https://.
NOTE: If there are SSL certificate errors, add -k (note the lowercase k) to the curl command. This will allow insecure server connections when using SSL.
curl -x "https://[email protected]:1111""https://www.ipinfo.io" -k
The above is an introduction to the common usage of cRUL command line in proxy. If you have any questions, please contact [email protected].