Page 1 of 1
Read dir
Posted: Wed May 01, 2002 5:05 pm
by Jose Arce
hi, i'm so new to php and i like to know if i can read dirs in another server...i heard it was possible..but dunno how, please help me here
Re: Read dir
Posted: Thu May 02, 2002 12:04 am
by phice
Jose Arce wrote:hi, i'm so new to php and i like to know if i can read dirs in another server...i heard it was possible..but dunno how, please help me here
Not not quite sure if this is even possible, due to the security threats other servers have. Although, I'm not exactly sure if this is right, or not.
Posted: Thu May 02, 2002 11:16 am
by fatal
yes ive seen examples that can open remote files. Use fopen() or maybe the opendir() function to open the file in question, then you can go from there.
Posted: Thu May 02, 2002 11:19 am
by fatal
Also look at this topic from the forums,
http://www.devnetwork.net/forums/viewtopic.php?t=149 more or less what you want (i think).
Posted: Thu May 02, 2002 4:14 pm
by dusty
using fopen and opendir are 2 completely different things. listing directory contents isn't possible across 2 different servers.
Posted: Thu May 02, 2002 7:05 pm
by Jose Arce
dusty wrote:using fopen and opendir are 2 completely different things. listing directory contents isn't possible across 2 different servers.
Ok...thx

Posted: Fri May 03, 2002 12:50 am
by sam
Well you could do a directory listing on the remote server feed the output to XML or something and then read it from the other server... Might be a bit more complex than you wanted
Cheers Sam
Posted: Fri May 03, 2002 7:43 pm
by Jose Arce
bit more coplex?
well, kinda another level for me jeje....but i'm willing to learn, don't you have a tutorial or somenthig? maybe a page...
Posted: Fri May 03, 2002 8:23 pm
by sam
Well on one server you ahve to use the opendir and readdir functions to get the directory contents... you have to then out put them with some kind of formating so that you can read them again. IE XML and then from the other server you have to use an fopen to read the page and then display the information. You have to have php enabled on both servers and have to have access to both as well.
Cheers Sam
Posted: Sat May 04, 2002 10:22 pm
by Jose Arce
but if i have no access for one of them...it will not be possible?
Posted: Sat May 04, 2002 10:32 pm
by phice
fatal wrote:yes ive seen examples that can open remote files. Use fopen() or maybe the opendir() function to open the file in question, then you can go from there.
fopen(); will do the exact same thing, as if you went to the site directly, in Internet Explorer, and did a
Right Click > View Source... Even if you did fopen();'d a remote file, on another server, you'd only get the HTML output, and no PHP code, much like the View Source trick, also.
opendir(); is strictly allowed to your server, and your server only. It will read the files on the directory that you specify, and generate a list of the file names.
Posted: Sun May 05, 2002 9:36 pm
by MacDaddy
true...the opendir(); function can be used to view files on a server that you aren't supposed to be viewing
But, that's only on the server that the file was uploaded on
Posted: Sun May 05, 2002 9:37 pm
by phice
MacDaddy wrote:true...the opendir(); function can be used to view files on a server that you aren't supposed to be viewing
But, that's only on the server that the file was uploaded on
exactly
