Mr.M 62 Future Programmers

Hi DW.

I am able to purchase from my online store but I don't seem to be able to get the pass through data which whould be sent to my notify_url. Payfast is my payment gateway and now it does call my notify_url because two files are created after I try to purchase but the files are blank and what I want is to get the posted variables and their values, but I'm not sure if the variables are posted on call or because even if I try to trap the $_POST I don't get any data.

Here is my notify_url script which should write file with posted data but the files are empty. The files created are the first two files not the failed file.

header( 'HTTP/1.0 200 OK' );
flush();

// Posted variables from ITN
$pfData = $_POST;
$myfile = fopen("payfastPost.txt", "w") or die("Unable to open file!");
$txt = $pfData;
fwrite($myfile, $txt);
fclose($myfile);
//update db
switch( $pfData['payment_status'] )
{
 case 'COMPLETE':
    // If complete, update your application, email the buyer and process the transaction as paid     
    $myfile = fopen("payfastComplete.txt", "w") or die("Unable to open file!");
$txt = $pfData;
fwrite($myfile, $txt);
fclose($myfile);
 break;
 case 'FAILED':                    
    // There was an error, update your application
    $myfile = fopen("payfastFailed.txt", "w") or die("Unable to open file!");
$txt = $pfData;
fwrite($myfile, $txt);
fclose($myfile);
 break;
 default:
    // If unknown status, do nothing (safest course of action)
 break;
}

Here is my purchase button:

<button id="cCart" type="submit"  class="btn btn-danger my-cart-btn my-cart-b" onClick="Javascript:window.location.href = 'https://sandbox.payfast.co.za/eng/process?merchant_id=10007327&amp;merchant_key=cdfgwzzwudp39&amp;item_name=test&amp;item_description=test&amp;payment_method=cc&amp;amount=5.00&amp;email_address=<?php echo $_SESSION['qwertp'];?>&amp;custom_str1=first&amp;custom_str2=xx&amp;custom_str3=<?php function Licenseuu() {$alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789"; $pass = array();$alphaLength = strlen($alphabet) - 1;for ($i = 0; $i < 12; $i++) {$n = rand(0, $alphaLength);$pass[] = $alphabet[$n];}return implode($pass);echo $pass;}?>&amp;custom_str4=p-nn&amp;custom_int1=5&amp;custom_int2=1&amp;custom_str5=<?php echo $_SESSION['xxfs'];?>&amp;notify_url=http://www.mydomain.com/pass.php?&amp;cancel_url=http://www.mydomain.com/cancelled.html&amp;return_url=http://www.mydomain.com/thankyou.html';">Buy Airtime</button>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.