FTP
| From: | Gustav Wiberg | Date: | Thu, 22 Sep 2005 18:40:17 +0000 |
| Subject: | FTP | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-223004@lists.php.net to get a copy of this message | ||
Hi all!
I took this code directly from PHP.net but I don't get it to work correctly...I've never worked with ftp-connections with PHP before...
<?php
$ftp_server = "ftp.example.com";
$ftp_user = "foo";
$ftp_pass = "bar";
// set up a connection or die
$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");
// try to login
if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) {
echo "Connected as $ftp_user@$ftp_server\n";
} else {
echo "Couldn't connect as $ftp_user\n";
}
// close the connection
ftp_close($conn_id);
?>
It seems to work fine when I'm trying on my testmachiner (WIndows XP + Apache) , but when I put the file on the webserver at my webhost (b-one), then I just get a blank page and showing source-code like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>
<BODY></BODY></HTML>
What could be the problem?
/G
http://www.varupiraten.se/