opendir(http://etc.): failed to open dir: not implimented

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mikebr
Forum Contributor
Posts: 243
Joined: Sat Sep 28, 2002 7:05 am

opendir(http://etc.): failed to open dir: not implimented

Post by mikebr »

I am having a problem with opendir and wonder if there is a way around this.

The error is:

Warning: opendir(http://loconation.users39.thehost.co.uk ... nbins/bin1): failed to open dir: not implemented in /home/x/y/locono/public_html/site/php_bin/get_folders.php on line 25

Line 25 is:

Code: Select all

if( !$dirContents = opendir($paths['ftphost'] . $paths['binsfolder'] . "/$suiteBin")) {
	$ua = "<FONT COLOR=RED><B>There was a problem opening the directory.<FONT></B>";
	} else {
// Run code
}
I think the reason is I am trying to access account1 from account2 on the same server using a php script and opendir() seems to through the "not implemented" error, I guess because the server does not permit this access, is there a way I can get around this? I need to count and check file types of files on the other server directory?

Thanks
SBro
Forum Commoner
Posts: 98
Joined: Tue Sep 30, 2003 10:06 pm

Post by SBro »

Yeah you can't open a directory using the opendir() command that isn't on your server. I think the ftp commands would be more suited for this purpose. They are all pretty self explanitory and can be found in the manual here
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

You can't read directories over HTTP, you can only read the document the server sends by HTTP.

The way to do what you are trying to achieve *would* be to use the full server path e.g. "/home/account1/public_html/folder/" but then it comes down to security permissions permitting that access to the other account.

As already mentioned, if both accounts are yours the FTP functions will do nicely. You just connect to ftp://localhost with your username and password and yippee, you have access.

Good Luck!
mikebr
Forum Contributor
Posts: 243
Joined: Sat Sep 28, 2002 7:05 am

Post by mikebr »

Yes that is correct, it is not possible to use the full server path. I have set up two accounts on the same server, a main account called account1 where the site is, and a second account called account2 so when the ftp's the account they can't see other directories such as the site folder as it won't exist.

I will take a look into using ftp://localhost

Thanks for the replies
Post Reply