in reply to Re^2: PayPal IPN Script End of script output before headers:
in thread PayPal IPN Script End of script output before headers:

Using the test script below I get the INVALID response (as I would expect).

c:\inetpub\wwwroot\test>perl ipn_test.cgi
Content-Type: text/plain

REQUEST
POST https://ipnpb.sandbox.paypal.com/cgi-bin/webscr
Host: ipnpb.sandbox.paypal.com
User-Agent: libwww-perl/6.38
Content-Type: application/x-www-form-urlencoded

cmd=_notify-validate&

RESPONSE
SUCCESS : INVALID
#!/usr/bin/perl # ipn_test.cgi use strict; use warnings; use CGI; use CGI::Carp 'fatalsToBrowser'; use LWP::UserAgent; my $q = CGI->new(); my $query = 'cmd=_notify-validate;'.$q->query_string; $query =~ s/;/&/g; my $PP_server = 'ipnpb.sandbox.paypal.com'; # sandbox IP:173.0.82.66 my $url = 'https://'.$PP_server.'/cgi-bin/webscr'; my $ua = LWP::UserAgent->new( ssl_opts => { keep_alive => 1, verify_hostname => 1, SSL_version => 'SSLv23:!TLSv12', } ); my $req = HTTP::Request->new('POST',$url); $req->content_type('application/x-www-form-urlencoded'); $req->header(Host => $PP_server); $req->content($query); my $msg; my $res = $ua->request($req); if ($res->is_success) { $msg = "SUCCESS : ".$res->decoded_content; } else { $msg = "ERROR : ".$res->status_line; } print "Content-Type: text/plain\n\n"; printf "REQUEST\n%s\n",$req->as_string; printf "RESPONSE\n%s\n",$msg;

If you want to run as a cgi you can use this html form to provide parameters

<html> <head></head> <body><h1>Paypal IPN Test</h1> <form action="ipn_test.cgi" method="post"> item_name : <input type="text" name="item_name" value="f1"/><br/> item_number : <input type="text" name="item_number" value="f2"/><br/> payment_status : <input type="text" name="payment_status" value="f3"/> +<br/> mc_gross : <input type="text" name="mc_gross" value="f4"/><br/> mc_currency : <input type="text" name="mc_currency" value="f5"/><br/> txn_id : <input type="text" name="txn_id" value="f6"/><br/> receiver_email : <input type="text" name="receiver_email" value="f7"/> +<br/> payer_email : <input type="text" name="payer_email" value="f8"/><br/> <input type=submit value="submit form"> </form> </body> </html>
HTH
poj