Sign in to follow this  
Followers 0
standsolid

URLDownloadToFile with Form Login

6 posts in this topic

Is there any way I could get a script to download a file, only after signing on with a form? I'd rather not use an external browser, if at all possible.

Share this post


Link to post
Share on other sites



Do you mean pop up a web form, have them sign in with it and then download a file?


Who else would I be?

Share this post


Link to post
Share on other sites

Do you mean pop up a web form, have them sign in with it and then download a file?

<{POST_SNAPBACK}>

I'd like to have the script be completely automatic. It would login using the form/post method, and retrieve the contents of the page that requires authentication. I wish I could share the page, but it is a proprietary trouble ticket tracking system used by my company.

basically, I want to make a front-end to this page so I can receive notifications beyond what email can bring.

I might have to use VB, but I am trying to avoid this at all costs.

Share this post


Link to post
Share on other sites

You might be successful if you login using to your page using the internet explorer (URLDownloadToFile is using the internet explorer) and then try to download your file. But if the website doesn't use standard authentication mechanisms there's no other way than to use a browser to login and let it download the file afterwards.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

You will have to "view source" on the login page. This is a long process, but it will give the results you need:

Go to the login page. Since I don't have your page, I will use google.com as an example.

Click on View menu -> Source. This will bring up notepad.

Search for <form

After form you will see action=(something) On google it is action="/search"

Here's the tricky part. You will have to search all <input fields after that to see which one is the one to use. I will not give you any more info on this.

When you find the right input, there will be a name=(something) That is the input field's identifier. On google it is name=q

You then add the page url, action and parameters in this manner:

http://www.google.com/search?q={whatever you are searching for}

If you have further input fields than one, you will add the following to that:

&{input name}={input value}

Then you can urldownloadtofile that page. For instance on google, if I wanted to download a search page for "cooking" then it would be

http://www.google.com/search?q=cooking

I have given you the answer, but you will have to figure out the rest by yourself. I would recommend looking up info on HTML.

Edited by this-is-me

Who else would I be?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I see no simple way to do this in AutoIt. Go VB or otherwise.

However instead of filling out forms you could simply make it a PHP page which redirects to the actual file. The script generates a random string from the current time and adds it onto the query (UNIX timestamp?).

http://www.mysite.com/mydownloadscript.php?code=1051508127

The script then checks to see if the current time is a match and if so, voila.

Just suggesting ideas, I don't know exactly what your doing.

Edited by darknuke

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0