• 0
Sign in to follow this  
Guest - José Augusto -

Perl Post

Question

Guest - José Augusto -

Caros amigos, tenho o codigo abaixo tirado de um livro, mas infelizmente não consigo rodar, é um codigo para processar formulario utilizando metodo post.

Grato José Augusto

#!perl

print "Content-type: text/html\n\n";

print "HTTP_USER_AGENT = $ENV{'HTTP_USER_AGENT'}<br>";

print "REQUEST_METHOD = $ENV{'REQUEST_METHOD'}<br>";

print "QUERY_STRING = $ENV{'QUERY_STRING'}<br>";

print "CONTENT_TYPE = $ENV{'CONTENT_TYPE'}<br>";

print "CONTENT_LENGTH = $ENV{'CONTENT_LENGTH'}<br>";

variable$qs = $ENV{'QUERY_STRING'};

character$qs = split(/&/,$qs);

$i (0 .. $#qs) {

$qs[$i] =~ s/\+/ /g;

$qs[$i] =~ s/%(..)/pack("c",hex($1))/ge;

($name, $value) = split(/=/,$qs[$i],2);

$qs{name} = $value;

}

print "Variables:<br><br>";

$name (sort keys(%qs));

{

print "$name = ", $qs{$name}, "\n"

}

exit;

Share this post


Link to post
Share on other sites

1 answer to this question

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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  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.

Sign in to follow this