----- Original Message -----
From: "John Nichel" <john@xxxxxxxxxxxx>
To: "PHP Mailing Lists" <php-general@xxxxxxxxxxxxx>
Sent: Thursday, September 22, 2005 8:53 PM
Subject: Re: FTP
Gustav Wiberg wrote:
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?
Is your web host running something other than Windows? Does it have the
ftp functions enabled? Make a phpinfo page, and access that in your
browser to see if the ftp functions are enabled. You are more than likely
not seeing the error on your host because they have error reporting turned
off. You can use ini_set to switch this if you want.
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
john@xxxxxxxxxxxx
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.4/109 - Release Date: 2005-09-21
Hi again!
Yes, you're right...
I get this error now...
Fatal error: Call to undefined function: ftp_connect() in
/customers/varupiraten.se/varupiraten.se/httpd.www/web/do_ftp.php on line 8
Isn't it enough to ftp to be a registred stream?
Here is the info of PHP...
http://www.varupiraten.se/web/phpinfo.php
/G
http://www.varupiraten.se/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php