Send Request via Proxy Server using Curl

Send Request via Proxy Server using Curl

When working with APIs, scraping web data, or simply testing connections, you may find yourself in need of sending HTTP requests through a proxy server. It can be used to hide the IP address, route the traffic through different geographical regions, or test the specific network scenarios. This tutorial demonstrates how to send a request via proxy server using a Curl.

To send a request through a proxy with Curl, we can use the -x or --proxy option. Both options are equivalent and allow specifying the proxy server's details. Here's the basic syntax:

curl -x <proxy-server>:<port> <URL>
curl --proxy <proxy-server>:<port> <URL>

Here is example:

curl -x http://102.223.186.246:8888 https://httpbin.org/get
curl --proxy http://102.223.186.246:8888 https://httpbin.org/get

When you execute one of these commands, Curl sends the HTTP request to the given URL via the specified proxy.

Leave a Comment

Cancel reply

Your email address will not be published.