File() command and fiel not found

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
gtm
Forum Newbie
Posts: 6
Joined: Sun Oct 16, 2005 10:22 am

File() command and fiel not found

Post by gtm »

Hello,

I am trying to read the contents of a file into an array using the file() command. The file is on an ftp site which has anonymous access and I can see the contents of the file if I browse to it. When I try to use the file command I get a warning that the file command failed to open stream.

I have used this sort of code before with other ftp sites so I am wondering if the problem is file permissions on the ftp server. If I can see the contents of the file in a brower is still possible the file is protected from the file command?

Any suugestions would be appreciated

Thanks

George
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

the ftp server may require login credentials, be they anonymous or not..
gtm
Forum Newbie
Posts: 6
Joined: Sun Oct 16, 2005 10:22 am

Post by gtm »

Thanks for the reply.

I have tried to use credentials like

Code: Select all

$fileData = file("ftp://anonymous:gmclean@ftp.ftpsite.edu/filename")
but have not had any success.

Is that what you were suggesting?
gtm
Forum Newbie
Posts: 6
Joined: Sun Oct 16, 2005 10:22 am

Post by gtm »

What file permissions do I need to use the PHP file() command? Do I need write access?

Is there any limit to the file name or what charactersare in the filename? The file on the ftp server I am trying to open is called

mm5_d2.extract.AHRHW.2005081500.f00

Thanks

George
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

it should only need read access via the ftp server.
it appears it should be okay, but you may have some errors that you aren't showing or aren't detecting related to the execution.. may want to research using the ftp commands as well...
Post Reply