wget returns “HTTP Error 403 – Forbidden”

Yesterday I log in to a friend’s GNU/Linux server and I wanted to test internet access.
I tried to do a search in google using wget as lynx was not installed. But I got a funny error.

melios@hostname:tmp$ wget http://www.google.com/search?q=world
–2010-10-22 22:04:22– http://www.google.com/search?q=world
Resolving http://www.google.com… 173.194.36.104
Connecting to http://www.google.com|173.194.36.104|:80… connected.
HTTP request sent, awaiting response… 403 Forbidden
2010-10-22 22:04:24 ERROR 403: Forbidden.

Google did not respond to my client (wget), because it was not a browser!!!
So, I rerun wget with ‘-U’ parameter, which means “user agent”, to emulate Firefox and avoid this flaw.

melios@hostname:tmp$ wget -U firefox http://www.google.com/search?q=world
–2010-10-22 22:10:39– http://www.google.com/search?q=world
Resolving http://www.google.com… 173.194.36.104
Connecting to http://www.google.com|173.194.36.104|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: unspecified [text/html]
Saving to: `search?q=world’
[ <=> ] 40,080 109K/s in 0.4s
2010-10-22 22:10:40 (109 KB/s) – `search?q=world’ saved [40080]

Funny error with simple solution 🙂

Regards,
Adrianos.

Democracy requires Free Software.

Advertisements

About Adrianos Dadis

Building Big Data & Streaming processing solutions in telcos business domain. Interested in distributed systems and enterprise integration.
This entry was posted in GNU/Linux and tagged . Bookmark the permalink.

Post your thought

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s