Saturday, July 11, 2009

PayPal Identity Token (PHP Script)

if (!$fp) { // HTTP ERROR } else { fputs ($fp, $header . $req); // read the body data $res = ''; $headerdone = false; while (!feof($fp)) { $line = fgets ($fp, 1024); if (strcmp($line, "\r\n") == 0) { // read the header $headerdone = true; } else if ($headerdone) { // header has been read. now read the contents $res .= $line; } }
// parse the data $lines = explode("\n", $res); $keyarray = array(); if (strcmp ($lines[0], "SUCCESS") == 0) { for ($i=1; $iaddPaymentDetails($keyarray['txn_id'], 'Paypal', $keyarray['mc_gross'], $keyarray['option_name1'],$status);
header("location:thanks_payment.php"); } else if (strcmp ($lines[0], "FAIL") == 0) { header("location:error.php"); // log for manual investigation //header("location:thanks_payment.php"); }
}
fclose ($fp);?>

No comments:

Post a Comment