I’m working on a PHP application that links into the Protx VSP Direct payment gateway. To handle ‘3D Secure’ requests from the credit card processing company, I need to forward the user to a different website, mimicking a form that has been posted. I’m trying to use the cURL libraries, but seem to have hit a problem. My code is the following:
<?php $ch = curl_init(); // Set the URL curl_setopt($ch, CURLOPT_URL, 'http://www.google.com/'); // Perform a POST curl_setopt($ch, CURLOPT_POST, 1); // If not set, curl prints output to the browser curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0); // Set the 'form fields' curl_setopt($ch, CURLOPT_POSTFIELDS, $fields); $output = curl_exec($ch); curl_close($ch); ?>
All this does is grab the content of the URL passed through, and doesn’t forward the user anywhere. I’ve tried Googling and reading up as much as I can, but can’t figure out what i’m missing. Any ideas? I don’t want to have to create a HTML form that auto-submits itself if I can avoid it.
Thanks for any help 🙂
The 3D Secure API doesn’t allow you to do the request in the background. You need to forward the user to the 3D secure site. Use javascript to automatically submit your form. Here’s what our provider suggests: