wget URL is forbidden, 403 error

  • Post author:
  • Post category:其他


refer to http://www.linuxquestions.org/questions/linux-software-2/wget-error-403-can-i-get-around-this-606755/

solution 1:

wget -U firefox http://xxx.xxx.com/

solution 2:

1) using firefox and command netcat to check the header,

2) wget -U xxx your.URL

If this is a problem related only to

wget

, but not other browsers, you may be able to spoof the site by using the wget ‘-U’ option, giving it a user-agent description of another browser.

Code:
wget -U 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.6) Gecko/20070802 SeaMonkey/1.1.4' http://yourURL.com

To see what a working browser sends as a user-agent header, you can run

netcat

on your localhost, and have a browser try to fetch a page from it:

Code:
nc -l -p 8000 -v

Now, in your browser, go to ‘http://localhost:8000’. Observe the user-agent header received by

netcat

. Cut and paste the string into the

wget

-U argument.



版权声明:本文为nomad2原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。