I'm trying to get information from a site that requires one to log in--all from a PHP script. The first step is then to log in via the script. I've found several tools that look like they should be able to do this task--post_it and cURL looking the most promising--but I'm having problems.
When I use post_it, I'm able to "log in" (specifying my user name and password, etc. and doing a "post" to the site) to this site and get a page returned to me that says it is "connecting to mainframe". (I get the same page returned to me when I do the post with "curl -d [login data] [url]".) The problem then is that the page isn't really what I need and apparently it gets redirected until it finally reaches the main menu page. Here is a snippet from the end of the page it returns:
<form method="POST" action="Validate_User.asp"
id="ValidatePage" name="ValidatePage">
</form>
</body>
</html>
<script LANGUAGE="JavaScript">
<!--
// function CheckErrors() /* this function runs on focus of the form to get the users local date */
// {
window.location.href = "default.asp";
//alert("Hello John")
// }
// -->
</script>
which somehow must try to forward to a page called default.asp. And I don't know how to "follow" the pages after this point. (A browser, of course, is able to follow redirects and all just fine, but can all that stuff be followed with a PHP script?) I get the page saying it is trying to connect just fine, but what happens after it is done connecting? The page I get passed to me doesn't even tell me whether the login/password were accepted--only that it's attempting to connect.
So if anyone could help me with what to do next, I'd really appreciate it. It probably doesn't help that they appear to use JavaScript to do their redirection (wouldn't some server side redirect function or a server-originated HTTP header to redirect be better than a silly JavaScript "href="?)
I don't even know why it tries to redirect to "default.asp". That seems to be the page that I started with (the login page) though, so I have no idea why it would want to return me there.
Here is the path (the pages) apparently taken when I log in with the browser.
default.asp -- the page with the login form, it submits it to the next page, which is
Validate_User.asp -- the "action" of the form -- don't know what goes on at this page, but eventually I end up at the next page, which is
MainMenu.asp -- when I log in normally with a web browser, this is where I end up, the main menu presented to authenticated users
How do I get to the last page (MainMenu.asp) in PHP by submitting a login post (or by some other way if that's not how it's done)?