carrots
carrots

Reputation: 825

How to access https page via wget or curl?

Let's say I want to save the contents of my Facebook page. Obviously fb uses https, thus ssl, how do I download the contents of a secure page using wget?

I found a lot of sources online... and I modify my command, but it doesn't save the page I want.

wget --secure-protocol=auto "https://www.facebook.com/USERNAMEHERE" -O index.html

Actually this is the result I'm getting in index.html: "Update Your Browser You’re using a web browser that isn’t supported by Facebook. To get a better experience, go to one of these sites and get the latest version of your preferred browser:"

Upvotes: 3

Views: 2168

Answers (1)

Jadi
Jadi

Reputation: 739

The problem is not the SSL / https. The problem is the fact that facebook sees "wget" as the agent and tells "update your browser".

You have to fool facebook with the --user-agent switch and imitate a modern browser.

wget --user-agent="Mozilla/5.0 (Windows NT 5.2; rv:2.0.1) Gecko/20100101 Firefox/4.0.1" https://facebook.com/USERNAME -O index.html

and then you will see the actual facebook page if you open index.html in a modern browser.

Upvotes: 15

Related Questions