0

Im using a batch that uses wget to download files from a directory that will run through a php page. the php will then forward the program to the correct directory for the download.

Here is a snippet of the PHP:

if (isset($_POST['update'])) {
    $host  = $_SERVER['HTTP_HOST'];
    $uri   = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
    $extra = $user;
    if (file_exists($extra)) {
        if ($_POST['update'] == 2) {
            header("Location: http://$host$uri/$extra/");
        } else if ($_POST['update'] == 3) {
            rename ($user,'z'.$user);
        } else { 
            echo "Update Available."; 
        }
    }
}

It is working well with a commercial server, but I cant make it work with the local IIS server that I setup. Most probably because of misconfiguration.

All other IF statements are working except for the HEADER LOCATION section.

Squashman
  • 11,987
  • 5
  • 23
  • 33
Jason A
  • 1
  • 2
  • You mean no header gets sent? Then pretty sure your script outputs anything prior to that. You should find a matching entry in your http servers error log file. This can easily happen for various reasons. Check your response. – arkascha Jan 07 '16 at 12:01
  • It is not a misconfiguration, it is a bad behaviour of IIS and raw php, rewriting headers. Have you the correct permissions on folders? – ares777 Jan 07 '16 at 12:03
  • thanks for stopping by. header location is working well, the index.html file that was generated by wget was the correct directory, listing the correct files to be downloaded. the problem is wget is not downloading anything. this is with my IIS setup. but with servers that was commercially setup, its all working fine. files are downloaded correctly. – Jason A Jan 07 '16 at 12:04
  • yes, permissions were corrected as it was a problem as well with the RENAME section of the snippet. still, did not work. – Jason A Jan 07 '16 at 12:14
  • when i use wget with the direct url, it downloads all the files with no problem. – Jason A Jan 07 '16 at 12:16
  • Where is the link to tag [tag:batch-file] (`*.bat` or `*.cmd`)?? – aschipfl Jan 07 '16 at 13:08
  • This solved my problem. [IIS 7.5, Web Service and HTTP 405 error](http://stackoverflow.com/questions/4287330/iis-7-5-web-service-and-http-405-error). But after another test, wget is downloading files with 0KB. Stuck again. – Jason A Jan 08 '16 at 09:05

0 Answers0