How to use wget with a proxy

28,253

Solution 1

You are using the wrong method, Let me tell you.

Go to home on your server or computer using cd ~

then create a file using vim like vi ~/.wgetrc

and paste your proxy URL inside the file using as below.

use_proxy = on
http_proxy =  http://70.32.89.160:3128
https_proxy =  http://70.32.89.160:3128
ftp_proxy = http://70.32.89.160:3128

now use below command to access your blocked side.

wget -e use_proxy=yes -e http_proxy=$proxy http://www.apkmirror.com

or try using wget http://www.apkmirror.com you will see below output.

[email protected]:~# wget www.apkmirror.co
--2017-04-21 08:12:45--  http://www.apkmirror.co/
Connecting to 70.32.89.160:3128... connected.
Proxy request sent, awaiting response... 301 Moved Permanently
Location: http://www.apkmirror.co/ [following]
--2017-04-21 08:12:47--  http://www.apkmirror.co/
Connecting to 70.32.89.160:3128... connected.
Proxy request sent, awaiting response... 200 OK
Length: 76512 (75K) [text/html]
Saving to: ‘index.html.8’

100%[===================================================================================================================>] 76,512       447KB/s   in 0.2s

2017-04-21 08:12:49 (447 KB/s) - ‘index.html.8’ saved [76512/76512]

Solution 2

you can use,this is:

wget -e use_proxy=yes -e http_proxy=http://ilanni:[email protected]:3128 http://oss.aliyuncs.com/aliyunecs/rds_backup_extract.sh

Solution 3

start wget through socks5 proxy using tsocks:

  1. install tsocks: sudo apt install tsocks
  2. config tsocks

    # vi /etc/tsocks.conf
    
    server = 127.0.0.1
    server_type = 5
    server_port = 1080
    
  3. start: tsocks wget http://url_to_get
Share:
28,253
Kurt Peek
Author by

Kurt Peek

Hi, I'm Kurt Peek, a backend engineer at Apple.

Updated on June 20, 2022

Comments

  • Kurt Peek
    Kurt Peek less than a minute

    I currently have been blocked from http://www.apkmirror.com, so a wget produces an ERROR 403: Forbidden:

    [email protected]:~$ wget http://www.apkmirror.com
    --2017-04-21 12:51:42--  http://www.apkmirror.com/
    Resolving www.apkmirror.com (www.apkmirror.com)... 104.19.135.58, 104.19.132.58, 104.19.133.58, ...
    Connecting to www.apkmirror.com (www.apkmirror.com)|104.19.135.58|:80... connected.
    HTTP request sent, awaiting response... 403 Forbidden
    2017-04-21 12:51:42 ERROR 403: Forbidden.
    

    I'm trying to use a proxy from https://free-proxy-list.net/ to gain access. For example, following https://www.gnu.org/software/wget/manual/html_node/Proxies.html, I've tried

    [email protected]:~$ wget http://[email protected]:3128
    --2017-04-21 12:57:56--  http://[email protected]:3128/
    Connecting to 70.32.89.160:3128... connected.
    HTTP request sent, awaiting response... 400 Bad Request
    2017-04-21 12:57:59 ERROR 400: Bad Request.
    

    but I get an ERROR 400: Bad Request. Is there anything wrong with this (attempted) usage of wget?