Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

user wget to authenticate

Status
Not open for further replies.

timgerr

IS-IT--Management
Jan 22, 2004
364
0
0
US
I want to backup a website of mine, I want to use wget but the initial page is protected with a username and password. Can I backup a webpage with wget and use a username + password?

Thanks,
-T

-How important does a person have to be before they are considered assassinated instead of just murdered?
-Need more cow bell!!!

 
You'll basically need to submit the form on the first page using wget. In the HTML source look at the [tt]action[/tt] and [tt]method[/tt] properties of the login form. If the method is [tt]get[/tt], then you just need to append the login data to the URL using the names of the input fields in the form. If the method is [tt]post[/tt], then you can use either [tt]--post-data[/tt] or [tt]--post-file[/tt] arguments to wget as described in the man page.

If the other pages are protected as well, and cookies are used to maintain the login information, it may be a little more complicated. But it's all in the man page.

If it's using HTTP BASIC authentication, then you need the [tt]--user[/tt] and [tt]--password[/tt] arguments to wget. Again, the details are in the man page.

--
-- Ghodmode

Give a man a fish and he'll come back to buy more... Teach a man to fish and you're out of business.
 
This is non form bases, it is a Apache protected directory.

-How important does a person have to be before they are considered assassinated instead of just murdered?
-Need more cow bell!!!

 
Okay. Apache protected is (usually) the HTTP BASIC authentication.

That's the one where you get the gray login and password box that's not actually part of the Web page.

So, you'll need to use [tt]--user[/tt] and [tt]--password[/tt]

--
-- Ghodmode

Give a man a fish and he'll come back to buy more... Teach a man to fish and you're out of business.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top