dreamwest Posted March 11, 2008 Share Posted March 11, 2008 Im trying to transfer video files from 1 domain to another for storage I found this old code in my collection but cant seem to get it configured correctly Or better yet - if anyone has a simple script for transferring files to another domain with a web based ftp and cron script?? #!/usr/bin/perl -s use Socket; # EXAMPLE OF HOW TO SETUP TO PULL A FILE LOCATED AT THE URL # http://members.ams.chello.nl/12b3/glowballz/flash/glowballzLogo.swf ################################################################################################### $remote = "site1.com/htdocs"; #THE DOMAIN NAME OF THE FILE SERVER $output = "/1205060978148238213.flv"; #THE FILENAME YOU ARE RETRIEVING $url = "/flvideo/1205060978148238213.flv"; #THE PATH OF THE URL YOU ARE RETRIEVING ################################################################################################### # END OF USER CONFIGURATION ################################################################################################### $port = 80; &superfetch ; exit(0); ################################################################################################### # RETRIEVE FILE ################################################################################################### sub superfetch { open (FILE, ">$output"); $submit = "GET $url HTTP/1.0\n\n"; if ($port =~ /\D/) { $port = getservbyname($port, 'tcp') } die "No port specified." unless $port; $iaddr = inet_aton($remote) || die "Could not find host: $remote"; $paddr = sockaddr_in($port, $iaddr); $proto = getprotobyname('tcp'); socket(SOCK, PF_INET, SOCK_STREAM, $proto) || die "socket: $!"; connect(SOCK, $paddr) || die "connect: $!"; send(SOCK,$submit,0); while(<SOCK>) { if ( /^[\r]??$/ ){ while (<SOCK>){ print FILE $_; } } } } Quote Link to comment https://forums.phpfreaks.com/topic/95700-transfer-video-files-from-1-domain-to-another/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.