cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Trouble Updating URL On Post

From: Justin <justin_at_sacloaves.org>
Date: Tue, 1 Apr 2008 15:31:05 -0700

Hello there,

I'm rather new to cURL and php, but I've been having a great time learning
and figuring things out. However, I've run into a problem that I haven't
been able to solve. Any help would be greatly appreciated. Here is the jist:

I'm receiving some variables from an external server (a credit card
processor) and they send their variables to me using a Get, or at least the
variables all show up in the URL. I want to take these variables and print
them on the screen for the user to see as a receipt, but I don't want all
the variables to be visible to them.

I thought in order to solve the problem I would create a
script(processreturn.php) that accepts the variables and then posts them to
another page(approved.php) so that the variables would not be visible in the
URL. The problem I'm having is that even after the POST the URL still stays
the same(still contains the variables) but the content of the page changes
to the new page? Any ideas on how to get the URL to update to the new
page(approved.php) and lose the variables in the URL?

Thanks in advance for any advice.

Here is my code:

ProcessReturn.php - This receives the information from the external server.

<?php

$ccnumber = $_GET['ssl_card_number'];
$amount = $_GET['ssl_amount'];
$expdate = $_GET['ssl_exp_date'];
$address = $_GET['ssl_avs_address'];
$city = $_GET['ssl_city'];
$state = $_GET['ssl_state'];
$zip = $_GET['ssl_avs_zip'];
$first = $_GET['ssl_first_name'];
$last = $_GET['ssl_last_name'];
$company = $_GET['ssl_company'];
$result = $_GET['ssl_result'];

if ($company=="approved") {
  $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL," /approved.php");
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS,

"ccnumber=$ccnumber&amount=$amount&frist=$first&last=$last&adress=$last&city
=$city&state=$state&zip=$zip&company=$company");
       
 

    curl_exec ($curl);
    curl_close ($curl);}

else {
  $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL," /declined.php");
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS,

"ccnumber=$ccnumber&amount=$amount&frist=$first&last=$last&adress=$last&city
=$city&state=$state&zip=$zip&company=$company");
    
    curl_exec ($curl);
    curl_close ($curl);}

?>

Approved.php - Here is where the POST goes if approved.
<?php

$ccnumber = $_POST['ccnumber'];
$cvc = $_POST['cvc'];
$amount = $_POST['amount'];
$expdate = $_POST['expdate'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$first = $_POST['first'];
$last = $_POST['last'];
$company = $_POST['company'];

?>
Your order has been approved. Please print the following transaction report
for your records.
<table border="0">
<tr><td><?php echo $first . " " . $last; ?></td></tr>
<tr><td><?php echo $company; ?></td></tr>
<tr><td><?php echo $ccnumber; ?></td></tr>
<tr><td><?php echo $amount; ?></td></tr>
<tr><td><?php echo $address; ?></td></tr>
<tr><td><?php echo $city; ?></td></tr>
<tr><td><?php echo $state; ?></td></tr>
<tr><td><?php echo $zip; ?></td></tr>
</table>

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2008-04-02