note 4510 modified in copy by jmoore

From: Date: Thu, 10 Aug 2000 21:18:41 +0000
Subject: note 4510 modified in copy by jmoore
Groups: php.notes 
Request: Send a blank email to php-notes+get-970@lists.php.net to get a copy of this message
I was wondering the same thing. so far, I am just fopen()'ing the file and doing read/write to the local file. Like so: <pre> if (!($fp = fopen($srcfile,"r"))) die("Could not open src"); if (!($fp2 = fopen($file,"w"))) die("Could not open dest"); while ($contents = fread( $fp, 4096 )) { fwrite( $fp2, $contents, strlen($contents) ); } fclose($fp); fclose($fp2); </pre> Just to be a little more clear on the above... the $srcfile is a URL (in my case, it's "http://www.slashdot.org/slashdot.xml" but it could be an FTP or any other proper URL) http://www.php.net/manual/function.copy.php

« previous php.notes (#970) next »