would some thing like this work
<?php
$conn = mysql_connect("****","****","*****");
mysql_select_db(******) or die(mysql_error());
$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$fp = fsockopen ('www.sandbox.paypal.com', 80, $errno, $errstr, 30);
$item_name = test
$payment_status = complete
$payment_amount = 1.00
$payment_currency = USD
$receiver_email = *****************
$payer_email = ************************
if (!$fp) {
echo "There was a problem connecting to the IPN server, check your port status.";
} else {
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIED") == 0) {
if ($payment_status != "completed") or ($receiver_email != "
[email protected]") or ($payment_amount != "payment amount here")
{
echo "No paying";
}
else
{
mysql_query("INSERT INTO `goods` (`username`, `key`, `downloadlink`) VALUES('hello', '55453234', 'http://blah.zip')") or die(mysql_error());
}
}
else if (strcmp ($res, "INVALID") == 0) {
echo ('oh well');
}
}
fclose ($fp);
}
?>