Jump to content

transfer video files from 1 domain to another


dreamwest

Recommended Posts

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 $_;
			}
		}
	}
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.