login website that using PHP

F

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.

Hope you could understand my question. Thank you very much!
 
D

Dennis Lee Bieber

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

--
 
S

stephen.thorne

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.
 
T

Tim Williams

----- Original Message -----
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: (e-mail address removed) <[email protected]>
Date: 26 May 2005 07:18:09 -0700
Subject: Re: Automatically populate and submit HTML Forms
To: (e-mail address removed)


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
 
F

Fuzzyman

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 :-(
 
J

J Correia

frost said:
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
 
D

Drazen Gemic

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
 
F

frost

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!!!!!
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top