Wget is a super-useful utility to download pages and automate all types of web related tasks. It works for HTTP as well as FTP URL's. Here is a brief tutorial on how to use wget through proxy server.
To get wget to use a proxy, you must set up an environment variable before using wget. Type this at the command prompt / console:
bash# export http_proxy="http://proxy.example.com:8080"
Replace proxy.example.com with your actual proxy server.
Replace 8080 with your actual proxy server port.
You can similarly use ftp_proxy to proxy ftp requests. An example on Linux would be:
bash# export ftp_proxy="http://proxy.example.com:8080"
Then you should specify the following option in wget command line to turn the proxy behavior on:
–proxy=on
Alternatively you can use the following to turn it off:
–proxy=off
You can use –proxy-username="username" –proxy-passwd="password" to set proxy user name and password where required.
Replace user name with your proxy server user name and password with
your proxy server password. Another alternative is to specify them in http_proxy / ftp_proxy environment variable as follows:
bash# export http_proxy="http://yourusername:yourpa...@proxy.example.com:8080
"
Example:
your proxy: proxy.domain.com
your proxy port: 8080
your proxy username: user01
your proxy password: giveme
You can type the command as follows:
bash# export http_proxy="http://user01:giv...@proxy.domain.com:8080
"
bash# wget -Y on http://anydomain.com/something_to_download.zip
Your download should start then ![]()
> bash# export http_proxy="http://user01:giv...@proxy.domain.com:8080"
> bash# wget -Y onhttp://anydomain.com/something_to_download.zip
>
You can also put http_proxy ins ~/.wgetrc file so you do not have to
export everytime.
On SUSE you can put the required proxy information in /etc/sysconfig/
proxy(or very easy GUI 'yast2 proxy') which is applied system wide and
used by all application including browsers, wget, torrents etc.
Cheers
-J