Re: [PHP] Copy Non-Text file from One Server to Another Issues

2009-03-12 Thread Daniel Brown
On Thu, Mar 12, 2009 at 14:51, Alice Wei aj...@alumni.iu.edu wrote:

 Warning: file_get_contents() expects parameter 1 to be string, resource
 given in C:\Inetpub\wwwroot\test\hello.php on line
 18

Freshman mistake.

$file2 = fopen($copydir . /play.txt, w+);

You're trying to read a data stream in file_get_contents() that
was opened with fopen().  Don't.

Instead, replace the line of code above with:

$file2 = $copydir.'/play.txt';

 and then RTFM on how to use file_get_contents().

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Copy Non-Text file from One Server to Another Issues

2009-03-12 Thread Alice Wei



 Date: Thu, 12 Mar 2009 14:55:52 -0400
 Subject: Re: [PHP] Copy Non-Text file from One Server to Another Issues
 From: danbr...@php.net
 To: aj...@alumni.iu.edu
 CC: php-general@lists.php.net
 
 On Thu, Mar 12, 2009 at 14:51, Alice Wei aj...@alumni.iu.edu wrote:
 
  Warning: file_get_contents() expects parameter 1 to be string, resource
  given in C:\Inetpub\wwwroot\test\hello.php on line
  18
 
 Freshman mistake.
 
 $file2 = fopen($copydir . /play.txt, w+);
 
 You're trying to read a data stream in file_get_contents() that
 was opened with fopen().  Don't.
 
 Instead, replace the line of code above with:
 
 $file2 = $copydir.'/play.txt';
 
  and then RTFM on how to use file_get_contents().
 
 -- 
 /Daniel P. Brown
 daniel.br...@parasane.net || danbr...@php.net
 http://www.parasane.net/ || http://www.pilotpig.net/
 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

Hi, Daniel:
  
   Thanks, it turned out that other than using your suggestion, it turned out 
that using copy() works great. 
   However, is it possible for me not to use the actual physical url as I have 
provided in my code to access the information I intend to copy? 
   My goal is to be able to search through the remote directory, and find the 
matched files of a certain format and copy it to another server. 

Is this possible?

Alice

_
Check the weather nationwide with MSN Search: Try it now!
http://search.msn.com/results.aspx?q=weatherFORM=WLMTAG