Reply to Re: [PHP] FTP

Your name:

Reply:


Posted by John Nichel on 10/21/85 11:27

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@kegworks.com

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация