PHP Doku:: Gibt den Systemtyp des entfernten FTP-Servers zurück - function.ftp-systype.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzSonstige DiensteFTPFTP-Funktionenftp_systype

Ein Service von Reinhard Neidl - Webprogrammierung.

FTP-Funktionen

<<ftp_ssl_connect

Gupnp>>

ftp_systype

(PHP 4, PHP 5)

ftp_systypeGibt den Systemtyp des entfernten FTP-Servers zurück

Beschreibung

string ftp_systype ( resource $ftp_stream )

Gibt den Systemtyp zurück des entfernten FTP-Servers zurück.

Parameter-Liste

ftp_stream

Der Verbindungshandler der FTP-Verbindung.

Rückgabewerte

Returns the remote system type, or FALSE on error.

Beispiele

Beispiel #1 ftp_systype()-Beispiel

<?php

// Verbindung aufbauen
$ftp ftp_connect('ftp.example.com');
ftp_login($ftp'user''password');

// Systemtyp abfragen
if ($type ftp_systype($ftp)) {
    echo 
"Example.com ist vom Typ $type\n";
} else {
    echo 
"Konnte den Systemtyp nicht bestimmen";
}

?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

Example.com ist vom Typ UNIX


2 BenutzerBeiträge:
- Beiträge aktualisieren...
jgbreezer at NOSPAM dot gmail dot com
7.04.2008 13:21
ftp_systype does NOT appear to be a reliable way to detect whether it is connected, as at least for a local network connection I have here to a Windows ftp server, it can succeed without a working connection (is it cached?). Don't know if this is specific to our ftp server - perhaps it doesn't behave well when it times out links.
Buckwheat469 at hotmail dot com
26.07.2006 18:41
ftp_systype can be a good way of checking the state of a connection, since PHP doesn't have a better system to check the state of an ftp connection (is_connected would be nice).

if (!($type = ftp_systype($conn_id))) {
    echo "FTP connection has failed! Trying again.\n";
    $conn_id = ftp_connect($ftp_server);
    $login_result = ftp_login($conn_id, $ftp_user, $ftp_pass);
}



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)