News:

Looking for documentation? Take a look on our wiki

Main Menu

Need to see the post data being sent to Paypal.

Started by bluefish001, April 15, 2010, 21:31:41 PM

Previous topic - Next topic

bluefish001

I knew how to do this but am drawing a blank. Need to confirm that the shipping total is being sent to Paypal in the post data for the transaction.

stinga

If you have perl and a webserver then you can change the paypal url to your webserver and run...


#!/usr/bin/perl
# ------------------------------------------------------------
# test.pl, by evenh@stud.unit.no
#
# Last updated: Jun 14, 1996
#
# This script slurps in everything from stdin and the
# query-string if there is one. It translates %xx encoding and
# displays all input given to the script.
#
# It should be compatible with any CGI-compatible HTTP server.
# Feel free to modify it! :-)
# ------------------------------------------------------------

# Print a title and initial heading
print "Content-type: text/html\n\n";

read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
`/usr/local/bin/gpush /tmp/data_dump.rpt`;

# Add query_string if it exists
$buffer = sprintf("%s%s%s", $buffer, ($buffer) ? "&" : "", $ENV{'QUERY_STRING'})
  if $ENV{'QUERY_STRING'};

# Split the name-value pairs
@pairs = split(/&/, $buffer );

foreach $pair (@pairs)
{
    ($name, $value) = split(/=/, $pair);

    # Un-Webify plus signs and %-encoding
    $value =~ tr/+/ /;
    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $name =~ tr/+/ /;
    $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

    # Uncomment for debugging purposes
    # print "Setting $name to $value<br>";

    # The next construction save multiple values by joining them
    # with '|' inbetween each value
    if ($FORM{$name}) {
       $FORM{$name} .= "|" . $value;
    } else {    $FORM{$name} = $value;
    }
}

print<<'EOF_HEADER';
<html>
<head>
   <title>Information passed to this script</title>
</head>
<body>
<h1>Information passed to this script</h1>


EOF_HEADER

if (%ENV) {
   print "<h2>Environment</h2>\n<PRE>\n";
   while (($key, $value) =  (each %ENV))
   {
     print "$key=$value\n";
   } print "</PRE>\n\n";
}

if (%FORM) {
   print "<H2>These Form-variables exists</H2>\n<PRE>\n";
   while (($key, $value) =  (each %FORM))
   {
      print "$key=$value\n";
   } print "</PRE>\n\n";
}

if (@ARGV) {
   print "<h2>Command-line arguments</H2>\n<PRE>\n";

   foreach (@ARGV) {
      print "$_\n";
   }

   print "</pre>\n";
}

print "<hr><address>This page is automatically generated</address>\n";
print "</body></html>\n";


I call it data_dump
Stinga.
614869 products in 747 categories with 15749 products in 1 category.
                                             Document Complete   Fully Loaded
                Load Time First Byte Start Render   Time      Requests      Time      Requests
First View     2.470s     0.635s     1.276s          2.470s       31            2.470s      31
Repeat View  1.064s     0.561s     1.100s          1.064s       4             1.221s       4

bluefish001

Need a clue here... how do I call the script?

Quote from: stinga on April 15, 2010, 22:21:43 PM
If you have perl and a webserver then you can change the paypal url to your webserver and run...


#!/usr/bin/perl
# ------------------------------------------------------------
# test.pl, by evenh@stud.unit.no
#
# Last updated: Jun 14, 1996
#
# This script slurps in everything from stdin and the
# query-string if there is one. It translates %xx encoding and
# displays all input given to the script.
#
# It should be compatible with any CGI-compatible HTTP server.
# Feel free to modify it! :-)
# ------------------------------------------------------------

# Print a title and initial heading
print "Content-type: text/html\n\n";

read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
`/usr/local/bin/gpush /tmp/data_dump.rpt`;

# Add query_string if it exists
$buffer = sprintf("%s%s%s", $buffer, ($buffer) ? "&" : "", $ENV{'QUERY_STRING'})
  if $ENV{'QUERY_STRING'};

# Split the name-value pairs
@pairs = split(/&/, $buffer );

foreach $pair (@pairs)
{
    ($name, $value) = split(/=/, $pair);

    # Un-Webify plus signs and %-encoding
    $value =~ tr/+/ /;
    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $name =~ tr/+/ /;
    $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

    # Uncomment for debugging purposes
    # print "Setting $name to $value<br>";

    # The next construction save multiple values by joining them
    # with '|' inbetween each value
    if ($FORM{$name}) {
       $FORM{$name} .= "|" . $value;
    } else {    $FORM{$name} = $value;
    }
}

print<<'EOF_HEADER';
<html>
<head>
   <title>Information passed to this script</title>
</head>
<body>
<h1>Information passed to this script</h1>


EOF_HEADER

if (%ENV) {
   print "<h2>Environment</h2>\n<PRE>\n";
   while (($key, $value) =  (each %ENV))
   {
     print "$key=$value\n";
   } print "</PRE>\n\n";
}

if (%FORM) {
   print "<H2>These Form-variables exists</H2>\n<PRE>\n";
   while (($key, $value) =  (each %FORM))
   {
      print "$key=$value\n";
   } print "</PRE>\n\n";
}

if (@ARGV) {
   print "<h2>Command-line arguments</H2>\n<PRE>\n";

   foreach (@ARGV) {
      print "$_\n";
   }

   print "</pre>\n";
}

print "<hr><address>This page is automatically generated</address>\n";
print "</body></html>\n";


I call it data_dump

stinga

How much do you know?
It is a cgi script so it needs to be in a directory on a webserver that can run cgi.

Then just change the call to PayPal with whatever your domain name is, something like http://<domainname>/data_dump. The normal VM processing will add all the PayPal parameters and this script will print it out.

If you want you could just point at the one on my machine...

www.recovery-cd-disk.com/cgi-bin/data_dump.pl
Stinga.
614869 products in 747 categories with 15749 products in 1 category.
                                             Document Complete   Fully Loaded
                Load Time First Byte Start Render   Time      Requests      Time      Requests
First View     2.470s     0.635s     1.276s          2.470s       31            2.470s      31
Repeat View  1.064s     0.561s     1.100s          1.064s       4             1.221s       4