Re: [PHP] Copy Function Errors

This is a discussion on Re: [PHP] Copy Function Errors within the PHP General forums, part of the PHP Programming Forums category; On Wed, Jul 16, 2008 at 4:45 PM, Wei, Alice J. <ajwei@indiana.edu> wrote: >> ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-16-2008
Daniel Brown
 
Posts: n/a
Default Re: [PHP] Copy Function Errors

On Wed, Jul 16, 2008 at 4:45 PM, Wei, Alice J. <ajwei@indiana.edu> wrote:
>> Hi,
>>
>> I have a snippet of code here:
>>
>> shell_exec("tar cvf /var/www/html/test/$id/data.tar /var/www/html/test/$id/data");
>>
>> $file1="http:/www.mysite.com/test/$id/data.tar";
>> $file2="http://www.mysite2.com/test/$id/.tar";
>>
>> copy($file1,$file2);
>>
>> I got the following error in the access log of the server:
>>
>> [Wed Jul 16 15:45:57 2008] [error] PHP Warning: copy(http://www.mysite.com/test/145/data.tar) [<a href='function.copy'>function.copy</a>]: failed to open stream: HTTP wrapper does not support writeable connections. in /var/www/html/beam_calculation.php on line 20
>>
>> Is there something I could do here to allow my file be "copied" to the remote server?

>
> Use the ftp functions.
>
> Thanks for the tip. I have revised my code to:
>
> // define some variables
> $local_file = "C:/Inetpub/wwwroot/test/$id/beamdata.tar";
> $server_file = "http://192.168.10.63/test/$id/beamdata.tar";
>
> // set up basic connection
> $ftp_server="http://192.168.10.63";
> $conn_id = ftp_connect($ftp_server);
>
> // login with username and password
> $ftp_user_name="apache";
> $ftp_user_pass="xxxxx";
> $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
>
> // try to download $server_file and save to $local_file
> if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) {
> echo "Successfully written to $local_file\n";
> } else {
> echo "There was a problem\n";
> }
>
> // close the connection
> ftp_close($conn_id);
>
> I have put this snippet in the local server of where I want the files to be copied to. However, I see this on my remote server in the logs:
>
> 192.168.10.62 - - [16/Jul/2008:16:40:24 -0400] "GET /beam_calculation.php?id=145&no=16 HTTP/1.1" 200 22 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"
>
> Is there something I have missed here?


Are you considered a "special student" at the University?

--
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:27 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0