mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 08:58:56 +00:00
- fixes in examples
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@211483 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
7b19b82b59
commit
0c955729b5
1 changed files with 9 additions and 6 deletions
|
@ -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 @@ $conn_id = ftp_connect($ftp_server);
|
|||
// 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
|
||||
|
|
Loading…
Reference in a new issue