Estoy usando este script que tomé del sitio de Paypal y lo adapté a mis necesidades.
Aquí copio la parte donde comparo las cadenas que envía Paypal para hacer una cosa u otra:
Código PHP:
<?
// read the post from PayPal system and add 'cmd'
$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}
// post back to PayPal system to validate
$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";
$attempts = 0;
while (1)
{
$attempts++;
if ($fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30))
{
break;
} else
if ($attempts > 4)
{
break;
}
}
if (!$fp) {
// HTTP ERROR
} else {
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIED") == 0) {
echo "VERIF";
// process payment
}
else {
// log for manual investigation
else if (strcmp ($res, "INVALID") == 0) {
echo "<font color='red'>".Transaction is not valid"</font>";
exit;
}
}
fclose ($fp);
}
?>
![enojado](http://static.forosdelweb.com/fdwtheme/images/smilies/enojado.png)
Sin embargo el pago se realizó en Paypal.
Si modifico el código resulta que de todas formas NO llegan las variables
![Neurótico](http://static.forosdelweb.com/fdwtheme/images/smilies/scared.png)
Alguna idea ?
Por favor por favor