FTP Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Try It Free
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:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old January 19th, 2004, 11:52 AM
JonnyThunder's Avatar
JonnyThunder JonnyThunder is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Sep 2002
Location: 667 - neighbour of the beast!
Posts: 1,088 JonnyThunder User rank is Second Lieutenant (5000 - 10000 Reputation Level)JonnyThunder User rank is Second Lieutenant (5000 - 10000 Reputation Level)JonnyThunder User rank is Second Lieutenant (5000 - 10000 Reputation Level)JonnyThunder User rank is Second Lieutenant (5000 - 10000 Reputation Level)JonnyThunder User rank is Second Lieutenant (5000 - 10000 Reputation Level)JonnyThunder User rank is Second Lieutenant (5000 - 10000 Reputation Level)JonnyThunder User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 3 Days 8 h 52 m 6 sec
Reputation Power: 81
FTP Problems

Ello,

I grabbed a script elsewhere on these forums, to test whether I can FTP to a server from where my webpages are hosted. Here is the script.....

PHP Code:
<?php
$FTP_Server 
"12.23.34.45";
$FTP_Port   "53";
$FTP_User   "myuser";
$FTP_Pass   "mypass";
$dirtolist  "/Main/";

$ftp ftp_connect($FTP_Server$FTP_Port);
if (
$ftp) {
    if (
ftp_login($ftp$FTP_User$FTP_Pass)) {
        
$dir ftp_rawlist($ftp$dirtolist);
        if (
$dir !== false) {
            foreach (
$dir as $key => $val) {
                
preg_match("/^(d)/"$val$matches);
                if (isset(
$matches[1]) && $matches[1] == "d") {
                    
$dirname substr(strrchr($val" "), 1);
                    print 
"<b>".$dirname."</b> is a directory<br>\n";
                }
            }
        }
    }
} else {
    print 
"Could not connect to FTP site " $FTP_Server ". Please try again later.";
    exit;
}
ftp_quit($ftp);
?>



Now, this script IS connecting OK - but for some reason it cannot seem to list the contents of a directory. I've also tried this....


PHP Code:
// set up basic connection
$conn_id ftp_connect("12.23.34.45""53");

// login with username and password
$login_result ftp_login($conn_id"myuser""mypass");

// Change directory
$chdir_result ftp_chdir($conn_id"/Main/");

// get contents of the current directory
$contents ftp_nlist($conn_id".");

// output $contents
var_dump($contents); 



But any way I try it, it wont seem to list directory files. Any ideas why this would be? It doesn't come up saying the connection failed (in the first example) but $dir is always false for some reason.

Cheers,
JT
__________________
www.badacid.net | www.vocalcafe.co.uk

Reply With Quote
  #2  
Old January 19th, 2004, 02:12 PM
JonnyThunder's Avatar
JonnyThunder JonnyThunder is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Sep 2002
Location: 667 - neighbour of the beast!
Posts: 1,088 JonnyThunder User rank is Second Lieutenant (5000 - 10000 Reputation Level)JonnyThunder User rank is Second Lieutenant (5000 - 10000 Reputation Level)JonnyThunder User rank is Second Lieutenant (5000 - 10000 Reputation Level)JonnyThunder User rank is Second Lieutenant (5000 - 10000 Reputation Level)JonnyThunder User rank is Second Lieutenant (5000 - 10000 Reputation Level)JonnyThunder User rank is Second Lieutenant (5000 - 10000 Reputation Level)JonnyThunder User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 3 Days 8 h 52 m 6 sec
Reputation Power: 81
anyone?

Reply With Quote
  #3  
Old January 19th, 2004, 02:27 PM
JonnyThunder's Avatar
JonnyThunder JonnyThunder is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Sep 2002
Location: 667 - neighbour of the beast!
Posts: 1,088 JonnyThunder User rank is Second Lieutenant (5000 - 10000 Reputation Level)JonnyThunder User rank is Second Lieutenant (5000 - 10000 Reputation Level)JonnyThunder User rank is Second Lieutenant (5000 - 10000 Reputation Level)JonnyThunder User rank is Second Lieutenant (5000 - 10000 Reputation Level)JonnyThunder User rank is Second Lieutenant (5000 - 10000 Reputation Level)JonnyThunder User rank is Second Lieutenant (5000 - 10000 Reputation Level)JonnyThunder User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 3 Days 8 h 52 m 6 sec
Reputation Power: 81
I noticed that if I try to access the FTP site through a browser using the ftp://username:password@IPADDRESS:port/ format, it comes up with this as an error....

An error occurred opening that folder on the FTP server. Make sure you have permission to access the folder.
Details:
200 Type set to A.
500 Invalid PORT command.
500 'LPRT 6,16... ...9,4,79': command not understood



I can access the FTP through an FTP client, but apparently can't do it through a browser. Can someone lettuce know what might be going on here?

Last edited by JonnyThunder : January 19th, 2004 at 02:31 PM.

Reply With Quote
  #4  
Old January 19th, 2004, 02:33 PM
JonnyThunder's Avatar
JonnyThunder JonnyThunder is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Sep 2002
Location: 667 - neighbour of the beast!
Posts: 1,088 JonnyThunder User rank is Second Lieutenant (5000 - 10000 Reputation Level)JonnyThunder User rank is Second Lieutenant (5000 - 10000 Reputation Level)JonnyThunder User rank is Second Lieutenant (5000 - 10000 Reputation Level)JonnyThunder User rank is Second Lieutenant (5000 - 10000 Reputation Level)JonnyThunder User rank is Second Lieutenant (5000 - 10000 Reputation Level)JonnyThunder User rank is Second Lieutenant (5000 - 10000 Reputation Level)JonnyThunder User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 3 Days 8 h 52 m 6 sec
Reputation Power: 81
It's OK folks. Solved it... needed to be in PASV mode!


Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationFTP Help > FTP Problems


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway