Jürgen: file_exists

Hallo

Ich will anhand des folgenden prüfen ob mein ftp online ist oder nicht

<?PHP
$datei = 'ftp://guest:guest@212.186.98.111/go.gif';
if(file_exists($datei))
echo '<img src="http://www.thebounceroom.com/images/online.gif" width="15" height="15" border="0">';
else
echo '<img src="http://www.thebounceroom.com/images/offline.gif" width="15" height="15" border="0">';
?>

Das problem, irgendwie haut das icht hin das er überprüft ob das file erreichbar ist oder nicht.
Das komische sit aber, wenn ich das go.gif auf meinen webspace lade (thebounceroom.com) und dann statt

$datei = 'ftp://guest:guest@212.186.98.111/go.gif';

angebe

$datei = go.gif';

geht es, jedoch solbald ich eine url angebe sprich

$datei = 'http://www.thebounceroom.com/go.gif';

geht es nicht mehr.
Errmm....hilfe??

Vielen dank schon mal im voraus,

Liebe grüße,

Jürgen

  1. Huhu Jürgen

    "This function will not work on remote files; the file to be examined must be accessible via the server's filesystem."
    http://www.php.net/manual/en/function.file-exists.php

    Viele Grüße

    lulu

    1. Hi

      "This function will not work on remote files; the file to be examined must be accessible via the server's filesystem."
      http://www.php.net/manual/en/function.file-exists.php

      Danke, das hilft mir jetzt aber auch nicht weiter, wie soll ich das jetzt machen, es muss doch irgendwie gehen das man sagt

      IF URL file exists .....img..online.gif

      ELSE

      .....offline.gif

      Gibts da irgendwie eine möglichkeit?
      Viele Grüße

      Jürgen

      1. Huhu Jürgen

        vielleicht kannst Du es mit fsockopen machen.
        http://www.php.net/manual/en/function.fsockopen.php

        Viele Grüße

        lulu

      2. Holladiwaldfee !

        "This function will not work on remote files; the file to be examined must be accessible via the server's filesystem."
        http://www.php.net/manual/en/function.file-exists.php

        Danke, das hilft mir jetzt aber auch nicht weiter, wie soll ich das jetzt machen, es muss doch irgendwie gehen das man sagt

        Der erste Kommentar zu file_exists:

        <cite>
        Use fopen function to check if a given URL exists.  See note added by
        chopin@csone.kaist.ac.kr within documentation for fopen for an example.
        </cite>

        Und bei fopen steht dann:

        <cite>
        $fp = @fopen("http://www.someurl.com/testfile.php3","r");
        if ($fp)
        { print"The file exists!"; }
        else
        { print"The file does not exist"; }
        </cite>

        Na, klingelts ? ;-)

        Ciao,

        Harry

  2. Mach halt so:

    • FTP öffnen.
    • Das File runterladen
    • Wenns fehlschlägt oder Länge = o ist: ist es nicht vorhanden!

    Hilfts?

    Martin