CoderZone.org

Category: >> PHP Code >> Copy File From Server Bookmark and Share

<< lastnext >>

Snippet Name: Copy File From Server

Description: This will retrieve a text file from a remote server and write it to yours.

Also see:
» Simple directory viewer / browser
» Read a web page directly in to a s...
» Recursive Directory Browser
» Saving Remote Images With PHP
» Include All Files In A Directory
» More File Type Detection in PHP
» Get Current Page URL
» Get Current Directory Name
» Measure script run time
» Write to File example
» Check if a file exists
» Export table to Excel or MS Word f...
» Count lines in file
» Remove All Files An A Given Direct...
» Calculate File/Folder Size In A Di...

Comment: (none)

Author: CoderZone
Language: PHP
Highlight Mode: PHP
Last Modified: March 16th, 2009

<?php
 
$inputfile = fopen("http://the-remote-server.com/inputfile.txt", "r");
$outputfile = fopen("outputfile.txt", "w");
echo "File opened...";
$data = '';
 
while (!feof($inputfile)) {
  $data .= fread($inputfile, 8192);
}
 
echo "Data read...";
fwrite($outputfile, $data);
echo "transfered data";
fclose ($inputfile);
fclose ($outputfile);
 
echo "Done.";
 
?>
 
 
There haven't been any comments added for this snippet yet. You may add one if you like.  Add a comment 
© coderzone.org | users online: 5