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

In reply to Re^3: PayPal IPN Script End of script output before headers: by poj
in thread PayPal IPN Script End of script output before headers: by *alexandre*

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.