|O:T| Can anyone translate for me this Perl code into PHP?

From: Date: Wed, 24 Jan 2001 08:02:11 +0000
Subject: |O:T| Can anyone translate for me this Perl code into PHP?
Groups: php.general 
Request: Send a blank email to php-general+get-36348@lists.php.net to get a copy of this message
Hello guys, I *know* it is totally OT, but, I need your help... Below is a piece of PERL code that I am trying to "translate" into PHP. It is quite simple code needed to send emails within a newsletter. I kind of tried to rewrite it in PHP but since I know *nothing* about Perl I found myself asking what does that means and what this... Could anyone who knows Perl that well write me a sketch of the equal script in PHP? It is simple, I can see it, but I do not understand what is that RegEx for, what is $pid ( fork() ) and where does it actually send emails... Thanks in advance, Maxim Maletsky <snip> #!/usr/bin/perl read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; if ($INPUT{$name}) { $INPUT{$name} = $INPUT{$name}.",".$value; } else { $INPUT{$name} = $value; } } $pid = fork(); print "Content-type: text/html \n\n fork failed: $!" unless defined $pid; if ($pid) { ... bla bla bla } else { close (STDOUT); open(LIST,"$INPUT{'address_file'}"); @addresses=<LIST>; close(LIST); foreach $line(@addresses) { chomp($line); open(MAIL, "|$INPUT{'mail_prog'} -t") || &error("Could not send out emails"); print MAIL "To: $line \n"; print MAIL "From: $INPUT{'listname'} <$INPUT{'from'}>\n"; print MAIL "Subject: $INPUT{'subject'}\n"; if ($INPUT{'html'}) { print MAIL "MIME-Version: 1.0\n"; print MAIL "Content-Type: text/html;\n"; print MAIL "Content-Transfer-Encoding: 7bit\n\n"; } print MAIL "$INPUT{'body'}"; print MAIL "\n\n"; if ($INPUT{'unsubchk'}) { print MAIL "===========================================================\n"; print MAIL "You have received this email because you subscribed to the $INPUT{'listname'} Mailing Service. To unsubscribe simply visit the link below.\n"; print MAIL "$INPUT{'url'}/unsub.phtml?list=$INPUT{'list'}&email=$line\n"; } print MAIL "\n\n"; close (MAIL); } } </snip> Maxim Maletsky - maxim@j-door.com <mailto:maxim@j-door.com> Webmaster, J-Door.com / J@pan Inc. LINC Media, Inc. TEL: 03-3499-2175 x 1271 FAX: 03-3499-3109 http://www.j-door.com <http://www.j-door.com/> http://www.japaninc.net <http://www.japaninc.net/> http://www.lincmedia.co.jp <http://www.lincmedia.co.jp/>

« previous php.general (#36348) next »