Skip to content

Instantly share code, notes, and snippets.

@randika
Last active December 14, 2015 14:08
Show Gist options
  • Select an option

  • Save randika/5098699 to your computer and use it in GitHub Desktop.

Select an option

Save randika/5098699 to your computer and use it in GitHub Desktop.
$fp = fsockopen ('ssl://www.sandbox.paypal.com', "443", $errno, $errstr, 30);
//$fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30);
if (!$fp) {
// HTTP ERROR
//sending a mail with error
}
else
{
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIED") == 0) {
$payment_status = $_POST['payment_status'];
$payment_amount = $_POST['mc_gross'];
$payment_currency = $_POST['mc_currency'];
$txn_id = $_POST['txn_id'];
$receiver_email = $_POST['receiver_email'];
$payment_date = $_POST['payment_date'];
$pending_reason = $_POST['pending_reason'];
//some code follows that's used to update tables n send mails
}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment