leszek Sun Apr 16 15:17:24 2006 UTC
Modified files:
/phpdoc/en/reference/ftp/functions ftp-fget.xml
Log:
- fixes in examples
http://cvs.php.net/viewcvs.cgi/phpdoc/en/reference/ftp/functions/ftp-fget.xml?r1=1.12&r2=1.13&diff_format=u
Index: phpdoc/en/reference/ftp/functions/ftp-fget.xml
diff -u phpdoc/en/reference/ftp/functions/ftp-fget.xml:1.12
phpdoc/en/reference/ftp/functions/ftp-fget.xml:1.13
--- phpdoc/en/reference/ftp/functions/ftp-fget.xml:1.12 Fri Jul 8 08:50:18 2005
+++ phpdoc/en/reference/ftp/functions/ftp-fget.xml Sun Apr 16 15:17:24 2006
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.12 $ -->
+<!-- $Revision: 1.13 $ -->
<refentry id="function.ftp-fget">
<refnamediv>
<refname>ftp_fget</refname>
@@ -83,9 +83,12 @@
<![CDATA[
<?php
-// open some file for reading
+// path to remote file
$remote_file = 'somefile.txt';
-$handle = fopen('localfile.txt', 'w');
+$local_file = 'localfile.txt';
+
+// open some file to write to
+$handle = fopen($local_file, 'w');
// set up basic connection
$conn_id = ftp_connect($ftp_server);
@@ -93,11 +96,11 @@
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
-// try to download $file
+// try to download $remote_file and save it to $handle
if (ftp_fget($conn_id, $handle, $remote_file, FTP_ASCII, 0)) {
- echo "successfully written to $file\n";
+ echo "successfully written to $local_file\n";
} else {
- echo "There was a problem with $file\n";
+ echo "There was a problem while downloading $remote_file to $local_file\n";
}
// close the connection and the file handler