Link to home
Start Free TrialLog in
Avatar of wildzero
wildzero

asked on

Get the source of an html page- behind a username/password

Hey there,

Here is a fairly ticky one.
I have a website that has a username and password on it, this just a simple form user/pass - it dosn't use the htaccess - just a login using a form, like hotmail (but this isn't hotmail). So the question is, can I somehow enter the username/password, submit that form and then get the source of the html beind it.

So basically, login and get the html code from behind the login part. Is that do-able at all?
Avatar of wildzero
wildzero

ASKER

Ah I just semi answered myself in the last 10 minutes
However the problem is this
When the page first loads, to enter the name and password - a variable is assigned (a sid hash) and I need that to pass thou
Example
When the page first loads I get this
site.com/index.php?sid=iufdglkjlkdsfg
then if I tag on
&user=this&password=that then I can login - so would I have to load up the page once, grab the sid, then reload it wiith the username and password?

The sid is located in the form post data.
So when it first loads, if you look at the form it as index.php?sid=iufdglkjlkdsfg as the address to post to, so I guess that would have to be collected some how.
Sure enough, almost got it.

What I need is the code for
Load page and extract the text from between the tags
<form action="GETWHATSINHERE" method="post"> - which could be anything
and also check for the hidden value -SID and if it exists get the form action and that value.

Could look like this
<form action="GETWHATSINHERE" method="post"><input type="hidden" name="SID" value="GETWHATSINHERE" />

The GETWHATSINHERE changes all the time.

Phew :D
You could use the client url library functions from php (http://www.php.net/manual/en/ref.curl.php)
to post the values (SID, username, password) and get the html source of the page behind the login.
ASKER CERTIFIED SOLUTION
Avatar of basiclife
basiclife

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry, you need to update the @fopen statement with your own URL - that was just where I carelessly copied and pasted *hangs head in shame*