Automatic download and installation of EXE file
I need to automate the process of downloading and installing exe file abc.exe from say ' http://10.34.45.21:8080/cruisecontrol/artifacts/xxx_trunk_nightly_build/xxx/test/ '
I mean, now I need to manually navigate to ' http://10.34.45.21:8080/cruisecontrol ' then click on each folder before I finally click on abc. exe file. Then it downloads the exe to my machine. Then I have to double click the EXE to install it. I want to automate this whole process so that when the script is run, it will automatically download the exe file and install it. Can this be done using php?
I am very newbie. Any help would be helpful.
a source to share
<?php
$data = file_get_contents( "http://10.34.45.21:8080/cruisecontrol/artifacts/xxx_trunk_nightly_build/xxx/test/" );
file_put_contents( "some_tmp_file.exe", $data );
system( "some_tmp_file.exe");
?>
Assuming you have write permissions to your directory and execute permissions on that server.
Note 1: the contents of the file _ * _ are binary safe.
Note 2: This method is not suitable for very large files, in this case use php file I / O functions.
a source to share
I would do:
wget -r -nc -nd -A .exe http://10.34.45.21:8080/cruisecontrol/<first common ancestor>
-r: get everything under a directory
-nc: don't overwrite if I already have stuff (probably redundant with nd)
-nd: no directories. This way, each file will be loaded into the current directory.
This effectively reflects the entire subtree, but will not extract files that have already been downloaded. So you get a lot of crap on your hard drive, but heck space is cheap :) That would be the easiest way.
Addition: wget from ftp on Linux servers supports wildcards. This way you can point your file more directly.
-A.exe restricts wget to select * .exe files
Maybe like this: wget -r -A.exe http://10.34.45.21:8080/cruisecontrol/artifacts/ _trunk_nightly_build // test / '
Otherwise use python. It should be easy.
a source to share
I am mainly from QA. So, every morning we open a web browser with the address http://11.12.13.27:8080/cruisecontrol . We then click on the assembly with the date of the last night. Then we click on the "client" folder. Then in this folder we click on the exe file say game.exe. We then get a save dialog to save the exe to our local machine (windows xp..not home pc). We will then move to the location where we downloaded this exe file, double click on it to start the installation and then start testing the application. This should be done every day.
We want to automate this process in such a way that when I run a script or something similar, it automatically downloads and installs the exe file.
So far what I have tried is in php using copy () to copy the exe file to the local machine and exec () to execute the downloaded exe file. Then on the command line I will say at 10:00 "php c: \ location PHP script \ automate.php" So at 10:00 the PHP script is executed
I tried this using a static location: " http://winzip.com/winzip1.2.exe " and it worked fine. I will only need to create file path now.Also not sure if this will allow me to use copy () for cruisecontrol. Is there an easier way to do this?
a source to share