Jump to content

PayPal Not Working


unemployment

Recommended Posts

For some reason I can't get this script working for my IPN.  Please help.

 

<?php

include("init.inc.php");

$send = 'cmd=_notify-validate&' . http_build_query($_POST);

$head  = 'POST /cgi-bin/webscr HTTP/1.0' . "\r\n";
$head .= 'Content-Type: application/x-www-form-urlencoded' . "\r\n";
$head .= 'Content-Length: ' . strlen($send) . "\r\n\r\n";

$fp = fsockopen('sandbox.paypal.com', 80);

if ($fp !== false){
fwrite($fp, $head . $send);
$response = stream_get_contents($fp);
$response = trim(end(explode("\n", $response)));

if ($response === 'VERIFIED' && $_POST['payment_status'] === "Completed" && $_POST['mc_gross'] === "10.00" && $_POST['mc_currency'] === "USD")
{
	$payer_email = $_POST['payer_email'];
	$q = mysql_query("UPDATE `users` SET `test` = '1' WHERE `email` = '$payer_email'");	
}
}

fclose($fp);

?>

Link to comment
https://forums.phpfreaks.com/topic/227021-paypal-not-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.