Se ftp server status på min hemsida.

Avdelningen för webbrelaterad programmering och grafisk design.
Post Reply
User avatar
forcevision
Posts: 418
Joined: 2007-06-17 11:21:44
Location: Göteborg

Se ftp server status på min hemsida.

Post by forcevision »

Hejsan !

Jag har en hemsida på ett webhotell. Från min hemsida där skulle jag vilja se status på min ftp server tex mm den är online eller offline & uptime. någon som har en bra php kodning för detta ?

/Force
User avatar
nva
Hedersbit
Posts: 2517
Joined: 2002-03-07 23:34:21
Location: Skåneland
Contact:

Post by nva »

Prova:

Code: Select all

if (!ftp_connect(host.se, 21, 2)) { echo "FTP är nere."; }
http://se.php.net/manual/en/function.ftp-connect.php
The three most dangerous things in the world are a programmer with a soldering iron, a hardware type with a program patch and a user with an idea.

In theory, there is no difference between theory and practice. But, in practice, there is.
User avatar
forcevision
Posts: 418
Joined: 2007-06-17 11:21:44
Location: Göteborg

Post by forcevision »

nva wrote:Prova:

Code: Select all

if (!ftp_connect(host.se, 21, 2)) { echo "FTP är nere."; }
http://se.php.net/manual/en/function.ftp-connect.php
Absolut det skall jag göra hur skriver jag för att det skall stå om ftp servern är online ?
User avatar
syntetisk
Posts: 2708
Joined: 2002-03-28 23:48:58
Location: Uppsala

Post by syntetisk »

Nu är inte jag någon programmerare, men borde det inte bara vara att skriva något i stil med else echo "online" (jag har ingen koll på syntaxen).
User avatar
Hein
Posts: 1291
Joined: 2002-03-09 19:38:38
Location: Norrland
Contact:

Post by Hein »

Code: Select all

if ( ftp_connect("my.host.se", 21, 2) )
{ 
     echo "FTP är uppe...";
}
else
{
     echo "FTP är nere...";
}

Code: Select all

echo "FTP är ".( (ftp_connect("my.host.se", 21, 2)) ? "uppe" : "nere" )."...";
. .. ... .... ..... ...... ....... ....... ..........
Post Reply