cioa guarda sei gentilissimo , sto perdendo ogni speranza nel frattempo

nel form paypal io ho :

Codice PHP:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
                    <
input type="hidden" name="cmd" value="_xclick"/>
                    <
input type="hidden" name="business" value="email_1291823428_biz@hotmail.it(business test email)"/>
                    <
input type="hidden" name="txn_type" value="express checkout" /> 
nello script IPN faccio come hai detto tu :

Codice PHP:
$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";

$sandbox = isset($_POST['test_ipn']) ? true false;

if (
$sandbox) {
    
$fp fsockopen ('ssl://www.sandbox.paypal.com'443$errno$errstr30);
} else {
    
$fp fsockopen ('ssl://www.paypal.com'443$errno$errstr30);
}


// recupero variabili da paypal
// - per inviare messaggio mail
// - per aggiornare database
$item_name            $_POST['item_name'];
$payment_amount        $_POST['mc_gross'];
$txn_id             $_POST['txn_id'];
$receiver_email        $_POST['receiver_email'];
$payer_email         $_POST['payer_email'];
$custom             $_POST['custom'];
$payment_status        $_POST['payment_status'];


if (!
$fp) {
    
// HTTP ERROR
     // Log an invalid request to look into
    
$myFile ='../paypal.txt';
$fh fopen($myFile'w') or die("can't open file");
$stringData "ERROR1  =>".$req."";
fwrite($fh$stringData);
fclose($fh);

else {
    
fputs ($fp$header $req);
    while (!
feof($fp)) {
        
$res fgets ($fp1024);
        
        if (
strcmp ($res"VERIFIED") == 0) {
            
            if ((
$payment_status == "Completed")) {
            
            
// potresti controllare anche
            // $txn_id !=0
            // $receiver_email = tuo_account_paypal
            
            // mando email
            // aggiorno database
            // etc
                   
$myFile ='../paypal.txt';
$fh fopen($myFile'w') or die("can't open file");
$stringData "VERIFIED";
fwrite($fh$stringData);
fclose($fh);

            }
        }

        else{
              
$myFile ='../paypall.txt';
$fh fopen($myFile'w') or die("can't open file");
$stringData "ERROR2";
fwrite($fh$stringData);
fclose($fh);
        }
       

    }
    
    
fclose($fp);

ho aggiunto un ultimo else{} allo script che mi hai fornito e per adesso viene sempre eseguito quello

ovvero nel file mi ritrovo sempre la scritta "ERROR2"

l'account business l'ho creato da zero e adesso risulta verified ..... davvero non capisco più cosa devo fare

grazie ancora ma qua la vedo dura uscirne