/    Sign up×
Community /Pin to ProfileBookmark

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.

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@NogDogAug 18.2010 — 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://").
Copy linkTweet thisAlerts:
@coldscooterauthorAug 18.2010 — 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.
Copy linkTweet thisAlerts:
@NogDogAug 18.2010 — 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.)
Copy linkTweet thisAlerts:
@NogDogAug 18.2010 — 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.
×

Success!

Help @coldscooter spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...