login website that using PHP

Discussion in 'Python' started by frost, Jun 20, 2005.

  1. frost

    frost Guest

    Hi,

    I am trying to login a website that using PHP and javascript. This is
    what happend if you browse that website using IE, after you login, you
    can go anywhere without enter your name and password again, as long as
    you keep that IE open, but after you close that IE, then later on open
    that website in a new window, you need to login again. I guess some
    session is created as long as your original login window dose not
    close.

    How I can handle this in python? I want get some information from that
    website. But the login page is not what I want, how can I simulate
    regular IE browser? I mean after I login, I can get to other pages from
    it, but I find my programe can't go other place except the login page.

    Hope you could understand my question. Thank you very much!
    frost, Jun 20, 2005
    #1
    1. Advertising

  2. On 19 Jun 2005 19:11:38 -0700, "frost" <> declaimed the
    following in comp.lang.python:

    > How I can handle this in python? I want get some information from that
    > website. But the login page is not what I want, how can I simulate
    > regular IE browser? I mean after I login, I can get to other pages from
    > it, but I find my programe can't go other place except the login page.
    >
    > Hope you could understand my question. Thank you very much!


    One word: Cookies

    --
    > ============================================================== <
    > | Wulfraed Dennis Lee Bieber KD6MOG <
    > | Bestiaria Support Staff <
    > ============================================================== <
    > Home Page: <http://www.dm.net/~wulfraed/> <
    > Overflow Page: <http://wlfraed.home.netcom.com/> <
    Dennis Lee Bieber, Jun 20, 2005
    #2
    1. Advertising

  3. frost

    Guest

    pbpscript is a little python toolkit for simulating a webbrowser,
    specifically for doing testing.

    It handles all the cookies and stuff for you. You might want to have a
    look at it.

    Stephen.
    , Jun 20, 2005
    #3
  4. frost

    Tim Williams Guest

    ----- Original Message -----
    From: "frost" <>


    > Hi,
    >
    > I am trying to login a website that using PHP and javascript. This is
    > what happend if you browse that website using IE, after you login, you
    > can go anywhere without enter your name and password again, as long as
    > you keep that IE open, but after you close that IE, then later on open
    > that website in a new window, you need to login again. I guess some
    > session is created as long as your original login window dose not
    > close.
    >
    > How I can handle this in python? I want get some information from that
    > website. But the login page is not what I want, how can I simulate
    > regular IE browser? I mean after I login, I can get to other pages from
    > it, but I find my programe can't go other place except the login page.



    Depending on your requirements, "ishy_browser" might help, I found it the
    very quick and easy to get running. It controls an IE window on your
    desktop and gives you access to each page's "objects". You need
    winGuiAuto to get it to work, but that's trivial.

    You can either import the script as a module, or wirte your own _main_
    based on the one in the script.

    I heard about it on this list.

    HTH :)


    ---------- Forwarded message ----------
    From: <>
    Date: 26 May 2005 07:18:09 -0700
    Subject: Re: Automatically populate and submit HTML Forms
    To:


    These two blog entries might be of help to you.

    http://www.ishpeck.net/index.php?P=b1115239318ishpeck
    second half is at
    http://www.ishpeck.net/index.php?P=b1115225809ishpeck
    Tim Williams, Jun 20, 2005
    #4
  5. frost

    Fuzzyman Guest

    The behaviour with the browser is what is known as a 'session cookie'
    -the site sets it when you login and the browser keeps it until you end
    the session by closing the browser.

    You handle the cookie using ClientCookie (Python 2.3) or cookielib
    (Python 2.4). You need to create a cookiejar instance and an opener
    that uses HTTPCookieProcessor (and your cookiejar).

    When you've done that - calls to your opener will fetch pages and
    handle the cookie *compeltely automatically*.

    There is an example of doing that at
    http://www.voidspace.org.uk/python/articles.shtml#http


    The authentication is via an html form. You can handle this using
    ClientForm - or you can look at the HTML source of the page and just
    have your opener (as above) send the right values to the URL. If you
    have problems - post the details here and people will help.

    It is *possible* that the javascript does 'magic' on the form
    submission (client side encryption is one possibility). That is very
    hard to automatically duplicate from Python because you would need to
    parse the python and mimic the page DOM to duplicate the effect. It
    might be easier to use PAMIE to automate the form submission in the
    browser. I've never tried this myself - but seen the announcements
    here.

    Best Regards,

    Fuzzy
    http://www.voidspace.org.uk/python
    unfortunately voidspace is temporarily down :-(
    Fuzzyman, Jun 20, 2005
    #5
  6. frost

    Guest

  7. frost

    Chris Curvey Guest

    Chris Curvey, Jun 20, 2005
    #7
  8. frost

    J Correia Guest

    "frost" <> wrote in message
    news:...
    > Hi,
    >
    > I am trying to login a website that using PHP and javascript. This is
    > what happend if you browse that website using IE, after you login, you
    > can go anywhere without enter your name and password again, as long as
    > you keep that IE open, but after you close that IE, then later on open
    > that website in a new window, you need to login again. I guess some
    > session is created as long as your original login window dose not
    > close.
    >
    > How I can handle this in python? I want get some information from that
    > website. But the login page is not what I want, how can I simulate
    > regular IE browser? I mean after I login, I can get to other pages from
    > it, but I find my programe can't go other place except the login page.
    >
    > Hope you could understand my question. Thank you very much!
    >


    Check here for some other examples, specifically 'Submitting values
    and clicking buttons in IE'
    http://tinyurl.com/7n7xf
    J Correia, Jun 20, 2005
    #8
  9. frost

    Drazen Gemic Guest

    On Sun, 19 Jun 2005 19:11:38 -0700, frost wrote:

    > Hi,
    >
    > I am trying to login a website that using PHP and javascript. This is
    > what happend if you browse that website using IE, after you login, you


    Browser remembers so called HTTP authorization header field. It sends
    authorization information whenever server requiress authorization by
    sending corresponding status code and, so called, realm specification.

    It is beyond the scope of this group and it is well described in HTTP
    standard and corresponding RFC.

    DG
    Drazen Gemic, Jun 20, 2005
    #9
  10. frost

    frost Guest

    Thank you all for the help. This problem bothered me for 3 days, Now I
    get it!!!!! You are right, it is the session cookie, after I use the
    cookiejar and the opener, I got it!!! I am really glad I found this
    place. Thank you again!!!!!
    frost, Jun 20, 2005
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ted Zeng
    Replies:
    4
    Views:
    471
    Tim Arnold
    Oct 3, 2006
  2. Ted Zeng
    Replies:
    0
    Views:
    599
    Ted Zeng
    Oct 13, 2006
  3. rockdale
    Replies:
    5
    Views:
    680
    Chad Scharf
    Jul 5, 2007
  4. torque63
    Replies:
    0
    Views:
    584
    torque63
    Jan 1, 2009
  5. Rajive Narain
    Replies:
    0
    Views:
    1,463
    Rajive Narain
    Sep 18, 2009
Loading...

Share This Page