RE: [PHP] Copy Non-Text file from One Server to Another Issues
| From: | Alice Wei | Date: | Thu, 12 Mar 2009 20:25:48 +0000 |
| Subject: | RE: [PHP] Copy Non-Text file from One Server to Another Issues | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-289957@lists.php.net to get a copy of this message | ||
> Date: Thu, 12 Mar 2009 14:55:52 -0400
> Subject: Re: [PHP] Copy Non-Text file from One Server to Another Issues
> From: danbrown@php.net
> To: ajwei@alumni.iu.edu
> CC: php-general@lists.php.net
>
> On Thu, Mar 12, 2009 at 14:51, Alice Wei <ajwei@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.brown@parasane.net || danbrown@php.net
> http://www.parasane.net/ ||
> http://www.pilotpig.net/
> 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW10000
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=weather&FORM=WLMTAG