
taha
New User
Feb 24, 2013, 9:33 AM
Post #1 of 4
(269 views)
|
|
Logging in and exploring a website
|
Can't Post
|
|
Hi, I am a member of an educational site with hundreds of videos. The videos are unfortunately not downloadable, but it is easy to find their links in html source code. So I want to write a script that logs into the website as me and explores the website to find all links to lecture videos' sqf files. Logging in is the part I am stuck at. I already tried reading the browser cookies using the LWP and HTTP::Cookies to fool the site into thinking that the script is authenticated, but I failed. Now I am trying to log in by submitting a form. Here is the code I wrote : use LWP ; %form = ('name' => 'name', 'pass' => 'pass', 'form_build_id' => 'form-fcffc0dc01d85f31e59f6b23ab05e7b3', 'form_id' => 'user_login', 'op' => 'Log in' ); $url = 'https://login.php'; $browser = LWP::UserAgent -> new(file => 'browdat.txt', autosave =>1); $browser -> cookie_jar({}); $l= $browser -> post($url , \%form);
I thought that the browser would contain the session cookies and that it would save them to the autosave file. But it does not do that, since the browdat.txt is empty after I run the program. So can you tell me how I can submit the login form and get the authentication cookies that I can use to view the next pages?
|