Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Code from PHP to Perl

by roboticus (Chancellor)
on May 04, 2013 at 17:02 UTC ( #1032062=note: print w/ replies, xml ) Need Help??


in reply to Code from PHP to Perl

remya:

You need only change your square brackets to curly brackets to turn it into valid perl code. Of course, you'll also need the appropriate constants and subroutines:

$ cat php_2_perl.pl #!/usr/bin/perl -w use strict; use warnings; use constant { CURLOPT_URL => 0, CURLOPT_POST => 0, CURLOPT_POSTFIELDS => 0, }; sub curl_init { print "Need to write curl_init\n"; } sub curl_setopt { print "Need to write curl_setopt\n"; } sub curl_exec { print "Need to write curl_exec\n"; } my ($ch, %_GET, $_POST); $_GET{pap_custom} = 5; # your code appears to be valid perl, given appropriate constant and # subroutine definitions... $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://affiliate.frankstrade.com/plugins/PayPal/paypal.php?pap_cu +stom=" . $_GET{'pap_custom'}); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST); curl_exec($ch); $ perl php_2_perl.pl Need to write curl_init Need to write curl_setopt Need to write curl_setopt Need to write curl_setopt Need to write curl_exec

...roboticus

When your only tool is a hammer, all problems look like your thumb.


Comment on Re: Code from PHP to Perl
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1032062]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2015-07-04 14:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls