CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Need a Custom or Prewritten Perl Program?: I need a program that...: Re: [Tsalagi] Play you tube vids: Edit Log



Zhris
Enthusiast

Jun 15, 2010, 9:27 PM


Views: 1912
Re: [Tsalagi] Play you tube vids

A very rough script which performs your specified task:


Code
#! /usr/bin/perl 
use strict;
use CGI ':standard';
$CGI::POST_MAX = 1000000;
print "content-type: text/html\n\n";
#####
my $mysubmit = param('mysubmit');
my $mytextarea = param('mytextarea');
#####
if ($mysubmit) {
if ($mytextarea =~ m/^<object.+<\/object>/) {
#Commented line below will autoplay video
#$mytextarea =~ s/(<embed src=\"[^\"]+)/$1&autoplay=1/;
print qq($mytextarea);
}
else {
print qq(<p>Invalid embed code</p>);
}
}
#####
print qq(<form action="script.pl" method="post"><textarea name="mytextarea">$mytextarea</textarea><input type="submit" name="mysubmit" value="Play Video" /></form>);


Chris


(This post was edited by Zhris on Jun 15, 2010, 9:49 PM)


Edit Log:
Post edited by Zhris (Enthusiast) on Jun 15, 2010, 9:49 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives