Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/07/2011, 03:24
Avatar de nuckzuniga
nuckzuniga
 
Fecha de Ingreso: marzo-2008
Mensajes: 71
Antigüedad: 16 años, 1 mes
Puntos: 0
Problema con IPN en PayPal

Hola foreros!

Les cuento, hace 2 días que estoy tratando de adaptar la tecnología IPN de paypal en el web de mi negocio. Leyendo en internet, encontre este script:

Código PHP:
mysql_connect("localhost""vizionso_ipn""holah") or die(mysql_error());  
mysql_select_db("vizionso_edsys_cnc") or die(mysql_error());
$url 'https://www.paypal.com/cgi-bin/webscr';
$postdata '';
foreach(
$_POST as $i => $v) {
$postdata .= $i.'='.urlencode($v).'&';
}
$postdata .= 'cmd=_notify-validate';
 
$web parse_url($url);
if (
$web['scheme'] == 'https') {
$web['port'] = 443;
$ssl 'ssl://';
} else {
$web['port'] = 80;
$ssl '';
}
$fp = @fsockopen($ssl.$web['host'], $web['port'], $errnum$errstr30);
 
if (!
$fp) {
echo 
$errnum.': '.$errstr;
} else {
fputs($fp"POST ".$web['path']." HTTP/1.1\r\n");
fputs($fp"Host: ".$web['host']."\r\n");
fputs($fp"Content-type: application/x-www-form-urlencoded\r\n");
fputs($fp"Content-length: ".strlen($postdata)."\r\n");
fputs($fp"Connection: close\r\n\r\n");
fputs($fp$postdata "\r\n\r\n");
 
while(!
feof($fp)) {
$info[] = @fgets($fp1024);
}
fclose($fp);
$info implode(','$info);
if (
eregi('VERIFIED'$info)) {
// yes valid, f.e. change payment status
mysql_query("INSERT INTO ipn (funciona) VALUES ('SI FUNCIONA') ") or die(mysql_error()); 
} else {
// invalid, log error or something
mysql_query("INSERT INTO ipn (funciona) VALUES('NO FUNCIONA);
}

Sin embargo, lo único que me ha salido hasta ahora es NO FUNCIONA. He tratado de todo, y aún no pasa nada. Alguien tiene una idea?

Gracias!