Some PHP FTP commands won't execute across domains.

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
burritobot
Forum Newbie
Posts: 1
Joined: Wed Feb 06, 2008 9:34 pm

Some PHP FTP commands won't execute across domains.

Post by burritobot »

Below is some php code for simply printing the array of filenames within the folder "images" at a certain FTP address.

The code works just fine if I use it within the same domain. (i.e. I execute the script on my mediatemple server, and define the FTP info as an FTP account within the same domain).

However, when I run the script on my mediatemple account, and define the FTP info on a different domain (a different mediatemple-hosted FTP site, different domain), it does nothing, then times out after 90 seconds.

Can anybody tell me what I'm doing wrong?

Code: Select all

<?php
 
$ftp_server=<IP address>;
$ftp_user_name =<username>;
$ftp_user_pass =<password>;
// set up basic connection
$conn = ftp_connect($ftp_server) or die("Could not connect");
if(ftp_login($conn,$ftp_user_name,$ftp_user_pass)){
    echo("connected<br>"); //this works no matter what
    echo ftp_systype($conn); //this also works
    print_r(ftp_nlist($conn,"images")); //this makes it hang and timeout after 90 secs
};
ftp_close($conn);
 
?>
Post Reply