PHP FTP and Playstream
Posted: Mon Dec 05, 2005 1:55 pm
Hi everyone,
I am a newbie to these kinds of forums so please go easy.
Situation/Question.
I have a php file on my webserver which connects to a playstream ftp server. After the connection has been made I try to list the contents for the directory and get nothing. However, when I FTP using other tools I am able to list the directory contents. The end goal is to be able to use the php ftp functions to upload files to the playstream ftp server. But for now, I will settle for trying to figure out why I am not getting a directory listing. For those that may wonder I do have ftp access to the playstream ftp server.
Below is my php code, what am I doing wrong?
Thanks all for your help in advance 
Jr.
Hawleyjr:
aakiny1 Welcome to DevNet. Please read the following link regarding posting code in the forum.
Posting Code Guide
I am a newbie to these kinds of forums so please go easy.
Situation/Question.
I have a php file on my webserver which connects to a playstream ftp server. After the connection has been made I try to list the contents for the directory and get nothing. However, when I FTP using other tools I am able to list the directory contents. The end goal is to be able to use the php ftp functions to upload files to the playstream ftp server. But for now, I will settle for trying to figure out why I am not getting a directory listing. For those that may wonder I do have ftp access to the playstream ftp server.
Below is my php code, what am I doing wrong?
Code: Select all
<?php
$ftpServer = "ftp.playstream.com";
$ftpUser = "myusername";
$ftpPass = "mypassword";
set_time_limit(0);
$conn = @ftp_connect($ftpServer)
or die("Couldn't connect to FTP server");
$login = @ftp_login($conn, $ftpUser, $ftpPass)
or die("Login credentials were rejected");
$workingDir = ftp_pwd($conn);
echo "You are in the directory: $workingDir<br>";
//Get a list of files and directories in the current working directory
$fList = @ftp_rawlist($conn, $workingDir);
//Display list
if(is_array($fList)) {
for($i = 0; $i < sizeof($fList); $i++) {
echo $fList[$i] . "<br>";
}
} else {
echo "$workingDir contains no files.<br>";
}
ftp_quit($conn);
?>Jr.
Hawleyjr:
aakiny1 Welcome to DevNet. Please read the following link regarding posting code in the forum.
Posting Code Guide