Hi Alice...

I just caught/saw this thread. I'm asuming you haven't found/solved what you're 
trying to do.

So, What exactly are you trying to accomplish? What OS are you running on both 
the client/server machine? Are you trying to copy from a directory on one box, 
to a directory on another box? Is this a one time thing? Are the boxes on the 
same network (physically close together)? Are you able to login to the remote 
box from your initial server?

Let me know what you're looking to do, and I can probably get you going.

What I am trying to accomplish is something simple, which is to copy the files 
from one single directory, which is already tarred, and have it be copied to a 
remote server. I am guessing that it is never too difficult to untar it when I 
get it successfully copied to another server. Right now it appears to me that 
it keeps on going to the second loop that says it failed, probably because my 
password and user do not match? I have tried switching that to apache, which is 
what I set in my httpd.conf for user and group.

I was browsing through the articles Todd suggested, and the port number 1025 
kept popping up. I am not sure if I am supposed to open this port on my remote 
and my local machine. I do have ssh, which is port 22 open.

Thanks in advance.

Alice

-regards...



-----Original Message-----
From: Boyd, Todd M. [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 16, 2008 2:28 PM
To: Wei, Alice J.
Cc: php-general@lists.php.net
Subject: RE: [PHP] Copy Function Errors


> -----Original Message-----
> From: Wei, Alice J. [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, July 16, 2008 3:46 PM
> To: Robert Cummings
> Cc: php-general@lists.php.net
> Subject: RE: [PHP] Copy Function Errors

---8<--- snip

> > 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?

Alice,

Here are some Wikipedia articles that should give you a good start on
understanding the fundamental differences between the two protocols you
are confusing with each other:

http://en.wikipedia.org/wiki/FTP
http://en.wikipedia.org/wiki/HTTP

HTTP itself does not intrinsically handle file uploads in a
server/client relationship. Web forms that include file uploads
generally have a handler function on the other end, and post files via a
form element.

FTP's main function is the transfer of files (hence [F]ile [T]ransfer
[P]rotocol), and is more in line with what you're trying to do here.

HTH,


Todd Boyd
Web Programmer

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

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

Reply via email to