I am trying to open a folder on a remote server and I cannot seem to get it to open using opendir(). have the correct path and I include the username and password for the server but it does not connect.
Can someone please take a look for me it is driving me crazy.
Here is the code for you to look at:
$pathname="http://username:Psswd@myserver.com/content/$path1/$path2/source";
echo ($pathname);
if (is_dir($pathname)) {
if ($dh = opendir($pathname)){
echo ("It opened");
while (false !== ($file = readdir($dh))){
if ($file != "." && $file != ".."){
echo("filename: $file <br><br>");
$destpath="/some/folder";
if (copy($pathname, $destpath)){
echo "Error File not Copied!!!";
}
}
}
}
}
It never seems to get past the line:
if (is_dir($pathname));