PoWah Wong wrote: 

> The login page is:
> http://safari.informit.com/?FPI=&uicode=
>
> How to figure out the login command?
>
> These two commands do not work:
>
> wget --save-cookies cookies.txt "http://safari.informit.com/?FPI= [snip]"
> wget --save-cookies cookies.txt
"http://safari.informit.com/?FPI=&uicode=/login.php? [snip]"

When trying to recreate a form in wget, you have to send the data the server
is expecting to receive to the location the server is expecting to receive
it. You have to look at the login page for the login form and recreate it.
In your browser, view the source to http://safari.informit.com/?FPI=&uicode=
and you will find the form that appears below. Note that I stripped out
formatting information for the table that contains the form and reformatted
what was left to make it readable.

<form action="JVXSL.asp" method="post">
  <input type="hidden" name="s" value="1">
  <input type="hidden" name="o" value="1">
  <input type="hidden" name="b" value="1">
  <input type="hidden" name="t" value="1">
  <input type="hidden" name="f" value="1">
  <input type="hidden" name="c" value="1">
  <input type="hidden" name="u" value="1">
  <input type="hidden" name="r" value="">
  <input type="hidden" name="l" value="1">
  <input type="hidden" name="g" value="">
  <input type="hidden" name="n" value="1">
  <input type="hidden" name="d" value="1">
  <input type="hidden" name="a" value="0">
  <input tabindex="1" name="usr" id="usr" type="text" value="" size="12">
  <input name="pwd" id="pwd" tabindex="1" type="password" value=""
size="12">
  <input type="checkbox" tabindex="1" name="savepwd" id="savepwd" value="1">
  <input type="image" name="Login" src="images/btn_login.gif" alt="Login"
width="40" height="16" border="0" tabindex="1" align="absmiddle">
</form>

Note that the server expects the data to be posted to JVXSL.asp and that
there are a bunch of fields that must be supplied in order for the server to
process the login request. In addition, the two fields you supply are called
"usr" and "pwd". So your first wget command line will look something like
this:

wget --save-cookies cookies.txt "http://safari.informit.com/JVXSL.asp";
--post-data="s=1&o=1&b=1&t=1&f=1&c=1&u=1&r=&l=1&g=&n=1&d=1&a=0&usr=wong_powa
[EMAIL PROTECTED]&pwd=123&savepwd=1"

Hope that helps!

Tony


Reply via email to