Debugging ipn.php when using paypal sandbox ipn simulator
===

How do I debut the ipn.php file when using the paypal sandbox ipn simulator tool?

The code looks like this:

    <?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";  
    
        $fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);  
    
        if (!$fp) {  
                // HTTP ERROR  
        } else {  
                fputs ($fp, $header . $req);  
    
                while (!feof($fp)) {  
                        $res = fgets ($fp, 1024);  
    
                        if (strcmp ($res, "VERIFIED") == 0) {  
    
                                $DBH = new PDO( "mysql:host=localhost;dbname=db", "user", "pass" );
                                $DBH -> setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
    
                                $STH = $DBH -> prepare( "update table2 set status = :status where tracking_id = :tracking_id" );
    
                                $status = 1;
                                parse_str($req, $data);
    
                                $STH -> bindParam( ':status', $status, PDO::PARAM_INT, 1 );
                                $STH -> bindParam( ':tracking_id', 'id_goes_here', PDO::PARAM_STR, 50 );
    
                                $STH -> execute();
    
                                $DBH = null;
    
    
                        }    
                        else if (strcmp ($res, "INVALID") == 0) {  
    
                                // do something else
    
    
                        }  
                }  
    
                fclose ($fp);  
        }  
    ?>  

I normally use netbeans debug facility to debug, but how do I debug using the sandbox simulator?  When I click `send ipn` from the sandbox ipn simulator, I get a message in the sandbox saying `IPN successfully sent.`, but when I then go into my database to check the `status`, it's still `0`.