Oh my God, this sounds awesome. Before researching this stuff, I had never had to use CURL before and I did not even realize there was a CURL utility in ChronoForms.
So here's the code that page from PayPal gives for this:
<?
$submiturl = "https://pilot-payflowpro.paypal.com/transaction:443/";
$plist="USER=****&VENDOR=****&PARTNER=****&PWD=****&TENDER=C&" .
"TRXTYPE=A&ACCT=5105105105105100&" .
"EXPDATE=1209&STREET= 123 MainSt.&CVV2=123&AMT=1.00";
$request_id = date('YmdGis');
$user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
// Here's your custom headers; adjust appropriately for your setup:
$headers[] = "Content-Type: text/namevalue"; // either text/namevalue or text/xml
$headers[] = "X-VPS-Timeout: 30";
$headers[] = "X-VPS-VIT-OS-Name: Linux"; // Name of your Operating System (OS)
$headers[] = "X-VPS-VIT-OS-Version: RHEL 4"; // OS Version
$headers[] = "X-VPS-VIT-Client-Type: PHP/cURL"; // Language you are using
$headers[] = "X-VPS-VIT-Client-Version: 0.01"; // For your info
$headers[] = "X-VPS-VIT-Client-Architecture: x86"; // For your info
$headers[] = "X-VPS-VIT-Integration-Product: MyApplication"; // For your info, application name
$headers[] = "X-VPS-VIT-Integration-Version: 0.01"; // Application version
$headers[] = "X-VPS-Request-ID: " . $request_id;
$user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $submiturl);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_HEADER, 1); // tells curl to include headers in response
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable
curl_setopt($ch, CURLOPT_TIMEOUT, 45); // times out after 45 secs
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // this line makes it work under https
curl_setopt($ch, CURLOPT_POSTFIELDS, $plist); //adding POST data
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); //verifies ssl certificate
curl_setopt($ch, CURLOPT_FORBID_REUSE, TRUE); //forces closure of connection when done
curl_setopt($ch, CURLOPT_POST, 1); //data sent as POST
// $info = curl_getinfo($ch); //grabbing details of curl connection
$result = curl_exec($ch);
$headers = curl_getinfo($ch);
curl_close($ch);
echo $result;
?>
So when I use Curl in my ChronoForm setup, I obviously am going to want to use the target URL provided above (https://pilot-payflowpro.paypal.com/transaction:443/, and the "pilot-" should be removed when the site goes live). I have questions for the other two Curl utility options.
First, do I need headers like the PHP code above from PayPal gives? I do not know what their purpose is and my best guess is that it works with HTTPS (an SSL certificate will apply to my form after I launch the site, right now it does not apply because the certificate does not apply to the test site).
And then the fields map; I'm assuming each of my fields need to be separated with line breaks, so I'll do that. But do each of the values necessarily have to be variables taken from field names? I really do not want to pass some of those variables through hidden fields, like obviously the login information for the PayFlow account. Do I need to run a custom PHP script before I run the Curl utility that just says something like the following?
$form->data['payflow_login_user'] = "my_user_name";
$form->data['payflow_login_vendor'] = "my_vendor_name";
$form->data['payflow_login_partner'] = "my_partner_name";
$form->data['payflow_login_pwd'] = "my_password";
I so much appreciate your help. Your product support has been really fantastic.