Tuesday, May 23, 2017

Curl with proxy

How to use curl with proxy:

  1. Method 1:
    1. Use export to set the env variable:
    2. export http_proxy=http://your.proxy.server:port/
    3. export https_proxy=https://your.proxy.server:port/
    4. Now curl should take the proxy from env variable
  2. Method 2:
    1. Use command line option
    2. -x, --proxy <[protocol://][user:password@]proxyhost[:port]>
    3. "-x, --proxy" means that either one can be used
    4. Example: curl -x http://proxy_server:proxy_port --proxy-user username:password -L http://url

~Sujith Emmanuel

No comments: