Read dir
Moderator: General Moderators
Re: Read dir
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.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
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).
- sam
- Forum Contributor
- Posts: 217
- Joined: Thu Apr 18, 2002 11:11 pm
- Location: Northern California
- Contact:
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
Cheers Sam
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.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.
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.