When testing my notify.php IPN handler script, my database is being updated several times. I read that paypal keeps executing the script until it gets a status 200 ok post back.

Well, I get the following warning: Cannot modify header information - headers already sent by (output started at /home/pwd/public_html/notify.php:8) in /home/pwd/public_html/notify.php on line 46

Line 8 is <?

Line 46 has this code:

if (!$_POST['txn_type'])
            { header("Status: 404 Not Found"); exit;
                                  }
            else
            { header("Status: 200 OK");

Any ideas?

    You can't output anything to the browser before the header().
    I can't see any "}"'s that close the "{"'s.

      I don't think anything is output to the browser. This is what is I have:

      // IPN Posting Modes, Choose: 1 or 2
      
      $postmode = "2";
      
             //* 1 = Live Via PayPal Network
             //* 2 = Test Via EliteWeaver UK
      
      
      // Convert Super globals on Older PHP builds
      
              if(phpversion() <= "4.0.6")
              {
                     $_POST = ($HTTP_POST_VARS);
                                    }
      
      // No IPN post Means this Script does Not exist :)
      
              if (!$_POST['txn_type'])
              { header("Status: 404 Not Found"); exit;
                                    }
              else
              { header("Status: 200 OK");
                                    }
      

        Even a whitespace before <? is an output.

          OK, I have taken out all the spaces, everything. Still get the error. Can it be anything else?

          Thanks for your help.

            Write a Reply...