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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.