www.webdeveloper.com
Results 1 to 5 of 5

Thread: opendir() on an external server

  1. #1
    Join Date
    Jun 2008
    Posts
    207

    opendir() on an external server

    Hi, I want to be able to check a directory on a different server from where i'm hosting my site.

    opendir('http://www.example.com/some_directory')

    Is this even possible? I am currently getting the error:

    [function.opendir]: failed to open dir: not implemented in...

    I could put a script on the other server to return the value, but i'd prefer to keep it contained.

    Thanks in advance.

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,227
    Can you use FTP to the remote server? If so, you could either use the PHP's FTP functions, or possibly opendir with the FTP wrapper ("ftp://" instead of "http://").
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Jun 2008
    Posts
    207
    Thanks for the response. I don't think i'm able to use opendir. I will instead use the php ftp functions. Although i worry a little about resource time, if i'm opening up lots of ftp connections all the time.

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,227
    I'm not sure there's a big difference between opening up a FTP resource or using a http URL wrapper via opendir(). Certainly the latter has few less lines of PHP code to parse and process, but once you get "under the hood", there may not be that much difference. (Or not, I couldn't be sure without doing some metering.)
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  5. #5
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,227
    PS: Don't forget to consider some sort of caching mechanism, especially if you don't expect the directory data to be changing minute to minute.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles