Sign in to follow this  
Followers 0
toothpick

How to download a file over HTTP? InetGet()?

4 posts in this topic

I need a script that will download a file that is handed to the browser when loading this address:

$fURL = "http://localhost/stofresh/admin/easypopulate.php?download=stream&dltype=full"
InetGet($fURL, "c:\spantech\stofresh\updates\current-full.csv")
_IELoadWait ($oIE, 5000)

When I browse to that URL manually, it generates a database file and pops up a download confirmation window. However, when I execute the code above, it says "Explorer cannot save easypopulate.php" It does save the current-full.csv file, but it contains the HTML from the login page earlier in the script... Can anybody help me out with this? TIA!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

If you use InetGet with IE UDF then you should know that it doesn't copies the header, just creates a new one. Thats the reason why it throws the login page.

I personally recommend the WinHTTP UDF, but it takes time till you work out your IE script to WinHTTP.

Edited by Izebize

Share this post


Link to post
Share on other sites

If you use InetGet with IE UDF then you should know that it doesn't copies the header, just creates a new one. Thats the reason why it throws the login page.

I personally recommend the WinHTTP UDF, but it takes time till you work out your IE script to WinHTTP.

Thanks for the help. I am looking at the WinHTTP UDF right now. But, without any help or example files, I have no clue how to use the functions. Any chance somebody can post a simple example that will download a file from a website?

Share this post


Link to post
Share on other sites

I am not really familiar with the inner workings of the HTTP protocol so it seems a bit hard for me to figure out. But I am trying. Any chance somebody can post a simple example that will download a file from a website using the WinHTTP UDF?

Are there other methods to make this work? It seems like a very simple thing I want to do. I am currently using software called Newbie Web Automation. It is very limited and based on a pascal based scripting language. AutoIt seems MUCH better so I am rewriting the Newbie scripts to work with it. In Newbie, I can download this file with one simple line:

GetURLFile('c:\spantech\ZEN-PPI\new\current-' + GetArrayParam(1) + '.txt', 'http://localhost/stofresh/admin/easypopulate.php?download=stream&dltype=' + GetArrayParam(1));

Thanks for the help!

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