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