I need to move or copy a simple text file from one web site to another web site.
I have administrator rights to both web sites. The first web site has a large data file (again, just a text file), certain records are selected and written to a team file (for entry into a tournament). Next I go through paypal and pay for the entries. The second site is for the the club running the tournament and I use IPN to return to a script on their site and if it verified, I add the team memebers into the master file for the tournament. I am limited to the ONE IPN script on the tournament site because I have a ton of other entries that come in from all over. The first site has the rosters for the state and no need to type all that data from each club, use the rosters like I use for all the non-paypal tounamenmts.
I can ftp the team file to the second server and place it in the folder just like it was created from scratch from that server originally and everything should go fine but I took the examples and tried them and nothing.
Here’s the code section:
my $custom = $in->param('custom');
my $filename = "$ENV{DOCUMENT_ROOT}/database/$custom";
my $usjochost = '208.109.14.105';
my $okserieshost = '208.109.181.196';
my $usjocuser = 'teamentry';
my $okseriesuser = 'okwaentry';
my $usjocpw = 'Password1';
my $okseriespw = 'Password1';
my $file = $custom;
my $usjocpath ='/home/content/u/s/j/usjoc/html/database/';
my $okseriespath ='/home/content/o/k/s/okseries/html/database/';
$ftp = Net::FTP->new($okserieshost, Debug => 0) or die "Could not connect to '$okserieshost': $@";
$ftp->login($okseriesuser, $okseriespw) or die sprintf "Could not login: %s", $ftp->message;
#$ftp->cwd(/database) or die sprintf "Could not login: %s", $ftp->message;
$ftp->get($filename);
#$ftp = Net::FTP->new($usjochost, Debug => 0) or die "Could not connect to '$usjochost': $@";
$ftp->quit;
I NEED to READ the file on the first web site (okseries.com) and write the file on the second web site (usjoc.com). I have no problem reading and writing the file on the server, is sending the file to the second server. HELP! I’m not a genius at PERL.
i tested the code you made and implemented to it, the follow code will connect to your first host, okserieshost and get the $filename from database folder, verify if the file was downloaded (if not it will end operations).
i’ve changed the code a little you can put this file on usjoc.com and run it on the browser it wil display every step of the communication until it gets the file from okseries.com.
All you have to do is change $path to the path of where the file is but do not end the directory name with a /
filename in case on $filename
$host = ftp ip or hostname
$uesr and $pass i guess you know what goes in
response from the url you asked to be viewed: