Annotation of embedaddon/php/ext/ftp/tests/ftp_fget_basic.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: FTP ftp_fget file for both binary and ASCII transfer modes
        !             3: --CREDITS--
        !             4: Nathaniel McHugh
        !             5: --SKIPIF--
        !             6: <?php
        !             7: require 'skipif.inc';
        !             8: ?>
        !             9: --FILE--
        !            10: <?php
        !            11: require 'server.inc';
        !            12: 
        !            13: $ftp = ftp_connect('127.0.0.1', $port);
        !            14: if (!$ftp) die("Couldn't connect to the server");
        !            15: 
        !            16: var_dump(ftp_login($ftp, 'user', 'pass'));
        !            17: 
        !            18: //test simple text transfer
        !            19: $fp = tmpfile();
        !            20: var_dump(ftp_fget($ftp, $fp ,'a story.txt', FTP_ASCII));
        !            21: fseek($fp, 0);
        !            22: echo fgets($fp);
        !            23: 
        !            24: $postition = ftell($fp);
        !            25: //test binary data transfer
        !            26: var_dump(ftp_fget($ftp, $fp, 'binary data.bin', FTP_BINARY));
        !            27: fseek($fp, $postition);
        !            28: var_dump(urlencode(fgets($fp)));
        !            29: 
        !            30: //test non-existant file request 
        !            31: ftp_fget($ftp, $fp ,'a warning.txt', FTP_ASCII);
        !            32: 
        !            33: //remove file
        !            34: fclose($fp);
        !            35: ?>
        !            36: --EXPECTF--
        !            37: bool(true)
        !            38: bool(true)
        !            39: For sale: baby shoes, never worn.
        !            40: bool(true)
        !            41: string(21) "BINARYFoo%00Bar%0D%0A"
        !            42: 
        !            43: Warning: ftp_fget(): a warning: No such file or directory  in %sftp_fget_basic.php on line %d

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>