Perl ftp question, like the previous ones ...

Posted by Jerry Scott on Stack Overflow See other posts from Stack Overflow or by Jerry Scott
Published on 2010-06-14T14:53:20Z Indexed on 2010/06/14 15:52 UTC
Read the original article Hit count: 237

Filed under:

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.

© Stack Overflow or respective owner

Related posts about perl