Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use wget with a proxy

Tags:

proxy

wget

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

kurt@kurt-ThinkPad:~$ 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

kurt@kurt-ThinkPad:~$ 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?

like image 346
Kurt Peek Avatar asked Dec 18 '22 07:12

Kurt Peek


1 Answers

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.

root@ubuntu:~# 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]
like image 158
aayushkamboj Avatar answered Dec 28 '22 08:12

aayushkamboj