Copyright
© 2003, Groundbreak.com. All rights reserved.
Any comments, suggestions, or mistakes: smiles@groundbreak.com
|
Triggering
commissions from within your scripts
It's actually
fairly simple to trigger commissions from within a script on your
site. For example, you could do this from a shopping cart script,
an order form, a lead form, or any other type of perl or php script.
Basically, the code will remotely call the sale.cgi script and send
along the appropriate variables to trigger a commission.
NOTE: When you
do this - your script is calling sale.cgi and NOT the visitors browser
so the affiliate cookie WON'T be read. You must already have this
value captured or present in the script. I will show you how to
capture it below, though, if your script is being executed directly
by the buyer or visitor's browser.
PERL
Code to remotely trigger a commission:
use
LWP::Simple; # this is only necessary if you haven't yet called
the LWP modules
$temp = get("http://www.yoursite.com/cgi-bin/affiliates/sale.cgi?cashflow=AMOUNT&affiliate=AFFILIATE&secret=SECRETWORD&goods=INVOICE");
Same code, but capturing the affiliate cookie beforehand:
use
LWP::Simple; # this is only necessary if you haven't yet called
the LWP modules
use CGI; $q = new CGI; # only if you haven't called these modules
in the script yet
$affiliate = $q->cookie('COOKIENAME'); # name of cookie from
affiliate program
$temp = get("http://www.yoursite.com/cgi-bin/affiliates/sale.cgi?cashflow=AMOUNT&affiliate=$affiliate&secret=SECRETWORD&goods=INVOICE");
PHP
Code to remotely
trigger a commission:
$handle
= fopen ("http://www.yoursite.com/cgi-bin/affiliates/sale.cgi?cashflow=AMOUNT&affiliate=AFFILIATE&secret=SECRETWORD&goods=INVOICE",
"r");
Same code, but
capturing the affiliate cookie beforehand:
if(isset($COOKIENAME))
{
$handle = fopen ("http://www.yoursite.com/cgi-bin/affiliates/sale.cgi?cashflow=AMOUNT&affiliate=$COOKIENAME&secret=SECRETWORD&goods=INVOICE",
"r");
}
All of the capital
words in the code above MUST be substituted with the proper variables
or values in order to trigger the commission properly. By default,
you ONLY need the cashflow variable (the purchase price) to trigger
the commission. The rest of the variables are optional.
Because of size
limitations some of the lines of code above are split onto multiple
lines...make sure to connect them when you're putting the code in
the script.
|