模拟网页而不显示它

I have an HTML page with a button that when pressed download a file. I need to create a new website that will include the possibility to download that file and I would like to use the first page to do that.
In other way I would like to make the new website to load the first HTML page without displaying it and use it only to download the file, emulating the button pressed.

The only way that comes to my mind is parsing the HTML page and discover where the file is located and then download it. Are there other way to do the same in PHP? And in Javascript?

While I would strongly urge against doing it, because it is much simpler to just go directly to the URL, if you need tools that can parse an html-page, perform actions on it, and do something with the results of those actions, you are in luck.

There is an entire suite of tools devoted to this purpose, namely those used by web application testers.

Check out Selenium as an example:

http://docs.seleniumhq.org/

It lets you configure "test scenarios" which can very easily download a page, search for a button, click that button, download the resulting file, and then do whatever else is needed. And since it's designed as a testing tool, it has very good built-in support for handling any steps failing ;)

There are many more of these tools; if you look up "automated browser testing" you'll probably find plenty, in all sorts of languages.