I am trying to include a dir listing into a page but can't seem to get it to work.
I am accessing the page from "http://mainsite.com/dl.php"

$url = "http://mysite.com/files";
include ($url);

This shows up fine and I see all the files in $url. The problem is when I click on any file it doesn't work.
i.e. I click on a file name "test.zip". The url shows "http://mainsite.com/test.zip" and of course the file is not found.

$url is on a different server and location.

Any ideas how to make it work?

    Hi Ribby

    I don't really understand your question. The include() function is there to allow you to include code/data from another file in your script. Thus you can include classes and functions stored elsewhere without having to paste them into your script every time.

    You can't include an entire folder of files. All your code does is include the string "http://mysite.com/files" in your PHP code. Thus I don't understand what you mean when you say "it shows up fine". What shows up and where?

    If you want to create links to a whole folder of files, you'll need to create and array of the file names and then iterate through the array adding the anchor tags to each one ... or something like that.

    Explain what it is you're trying to do and perhaps the answer will be forthcoming.

    Norman

      I don't understand it either but try adding the $url variable before the zip file name

      <?php
      $url = "http://mysite.com/files";
      include ($url);
      
      echo "<a href='$url/test.zip' >Test</a>";
      
      ?>

      Why don't you just use include(http://mysite.com/files);?

        Sorry I was not clear.
        What I am trying to do is be able to download files from my other web site without actuly going there.

        I would like to be able to download test.zip along with hundreds of other files. It resides at http://72.25.11.58/files/test.zip.
        I need to be able to access that file thru http://mysite.com/test.zip

          so you want it to appear it's from your site?
          I don't know a way to do this.

            harmor wrote:

            so you want it to appear it's from your site?
            I don't know a way to do this.

            Yes, I want it to appear its from my site.

              Rodney H. wrote:

              Why not use an iframe?

              I've never heard of iframe. I will look it up.

                iframe is a cool and I will play with it in the future but,
                I need to be able to access test.zip using url header only. This is for a redirect I am attemting to write that will direct the game servers request thru my main site to the server I have the files on.

                  Write a Reply...