FTP Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationFTP Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old March 1st, 2004, 03:42 PM
Morrigan's Avatar
Morrigan Morrigan is offline
Midnight Rider
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: Quebec, Canada
Posts: 58 Morrigan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Question file() doesn't take FTP URLs?

Hello all,

I'm trying to use the file() function to retrieve the content of a file stored on a remote server, accessible only by FTP.
So the line would be,
Code:
$data = file("ftp://username:password@server.com/path") or die ("can't read file");
print_r($data);

And this works on some servers, but not all - either I get all the data, or I get the "can't read file" message. And unfortunately, it doesn't work on the server that I need it to be working on.

And another weird thing is that fopen_wrappers are enabled on every server, so that's not the problem here. In fact, all servers will take an HTTP URL as parameter - but for some reason, one won't take the FTP url parameter. Safe mode is off, too, so it's not the issue either.
Any idea why, and what I could do to get it to work?
Thanks.
__________________
Encyclopaedia Metallum: The Metal Archives - the Ultimate Heavy Metal Archives! If it's not there, add it yourself.

Reply With Quote
  #2  
Old March 2nd, 2004, 09:12 AM
Morrigan's Avatar
Morrigan Morrigan is offline
Midnight Rider
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: Quebec, Canada
Posts: 58 Morrigan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Bump?

Reply With Quote
  #3  
Old March 2nd, 2004, 09:17 AM
Insano Insano is offline
Programming newbie
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 16 Insano User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I'm new at this, but do you need to log in to that server? The ones it's working on may allow anonymous access, but possible this one doesn't?

Reply With Quote
  #4  
Old March 2nd, 2004, 09:42 AM
Morrigan's Avatar
Morrigan Morrigan is offline
Midnight Rider
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: Quebec, Canada
Posts: 58 Morrigan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Yes, I have to log in to that server, with a username and password. No anonymous access.

Reply With Quote
  #5  
Old March 2nd, 2004, 09:54 AM
Insano Insano is offline
Programming newbie
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 16 Insano User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I haven't had to open files from an FTP server yet. I've just downloaded them using php scripts. I'm sure someone here will be able to help you though.

Reply With Quote
  #6  
Old March 2nd, 2004, 01:55 PM
Morrigan's Avatar
Morrigan Morrigan is offline
Midnight Rider
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: Quebec, Canada
Posts: 58 Morrigan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Well, I suppose an alternative would be to download the files on the local server, then read them locally, but that would probably take much longer.

Reply With Quote
  #7  
Old March 3rd, 2004, 10:47 AM
Morrigan's Avatar
Morrigan Morrigan is offline
Midnight Rider
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: Quebec, Canada
Posts: 58 Morrigan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
So no one knows what could cause this?

Reply With Quote
  #8  
Old March 3rd, 2004, 10:55 AM
xlordt's Avatar
xlordt xlordt is offline
Only the strong survives!!.
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Feb 2003
Location: A World of wonder.
Posts: 5,537 xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)  Folding Points: 108660 Folding Title: Super Ultimate Folder - Level 1Folding Points: 108660 Folding Title: Super Ultimate Folder - Level 1Folding Points: 108660 Folding Title: Super Ultimate Folder - Level 1Folding Points: 108660 Folding Title: Super Ultimate Folder - Level 1Folding Points: 108660 Folding Title: Super Ultimate Folder - Level 1Folding Points: 108660 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 4 Weeks 1 Day 21 h 42 m
Reputation Power: 378
Send a message via ICQ to xlordt Send a message via AIM to xlordt Send a message via MSN to xlordt Send a message via Yahoo to xlordt Send a message via Google Talk to xlordt Send a message via Skype to xlordt
Facebook
Quote:
Originally Posted by Morrigan
So no one knows what could cause this?


The best way to do this is by using the FTP Function then reading the file this way it would save you lots of trouble, btw this way wont take long all you are doing is getting the file and reading of it.. i think the way you are doing it will take longer is the connection is keeped open

Reply With Quote
  #9  
Old March 3rd, 2004, 11:22 AM
Morrigan's Avatar
Morrigan Morrigan is offline
Midnight Rider
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: Quebec, Canada
Posts: 58 Morrigan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Quote:
Originally Posted by xlordt
The best way to do this is by using the FTP Function then reading the file this way it would save you lots of trouble, btw this way wont take long all you are doing is getting the file and reading of it.. i think the way you are doing it will take longer is the connection is keeped open


I know of the FTP function, but I don't see how it would help me. How do you READ a file's content with the FTP functions? I would have to first download (ftp_get()) the file, and then read it (again with file()) anyway.
Here is what it says at the very top of the page you linked:
Quote:
If you only wish to read from or write to a file on an FTP server, consider using the ftp:// wrapper with the filesystem functions which provide a simpler and more intuitive interface.


But I guess that's impossible for this server. Looking at the ftp:// wrapper page, it says here:
Quote:
Allows read access to existing files and creation of new files via FTP. If the server does not support passive mode ftp, the connection will fail.

But that "server", would it be the FTP that I connect TO, or the server FROM which I connect? If it's the first case, it cannot explain why I can read the file from some servers and not others.

Last edited by Morrigan : March 3rd, 2004 at 11:36 AM.

Reply With Quote
  #10  
Old March 3rd, 2004, 11:28 AM
xlordt's Avatar
xlordt xlordt is offline
Only the strong survives!!.
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Feb 2003
Location: A World of wonder.
Posts: 5,537 xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)  Folding Points: 108660 Folding Title: Super Ultimate Folder - Level 1Folding Points: 108660 Folding Title: Super Ultimate Folder - Level 1Folding Points: 108660 Folding Title: Super Ultimate Folder - Level 1Folding Points: 108660 Folding Title: Super Ultimate Folder - Level 1Folding Points: 108660 Folding Title: Super Ultimate Folder - Level 1Folding Points: 108660 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 4 Weeks 1 Day 21 h 42 m
Reputation Power: 378
Send a message via ICQ to xlordt Send a message via AIM to xlordt Send a message via MSN to xlordt Send a message via Yahoo to xlordt Send a message via Google Talk to xlordt Send a message via Skype to xlordt
Facebook
I have a script similar to something like this.. this is why i said to do it this way, you would have to download it and open it this way.. but its faster and better cause your not keeping any connection alive,.. if you dont know how to do it properly it can be a security hazard.. anyways to me php is not meant to do any server connections.. even if its there ( just my opn )

Reply With Quote
  #11  
Old March 3rd, 2004, 11:37 AM
Morrigan's Avatar
Morrigan Morrigan is offline
Midnight Rider
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: Quebec, Canada
Posts: 58 Morrigan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Ok, well I guess I have no choice. Don't worry, I have no problems doing this way. As for your last comment, well I just happen to have no choice in the matter. :\

Thanks for the advice.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationFTP Help > file() doesn't take FTP URLs?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |