11 replies
I finally found a link cloaking script that hides your clickbank id in the browser but it doesn't pass a tracking id.

Can anyone help me with this script?

#!/usr/bin/perl
use CGI;
use LWP::UserAgent;
my $q=new CGI;

### specify here your default affiliate nickname. it will be used
### if you don't add parameter a=youraffnick in the URL (see README.TXT)
$affnick = "cbnickname";
################################################## ##############################
### nothing to change below
################################################## ##############################
$v = $q->param("v");

if (!$q->param("a")) {
$a = $affnick;

}else{
$a = $q->param("a");
}

if (!$q->param("v")){
print "Content-type: text/html\n\n";
print "Error: vendor nickname not specified\n";
exit;
}

$url = "http://$a.$v.hop.clickbank.net";
GetLink($url);
&PrintPage;

sub GetLink {
$nurl=shift;
$id=shift;
$ua = new LWP::UserAgent;
$ua->agent("Mozilla/4.0");
$req = new HTTP::Request 'GET' => $nurl;
$req->header('Accept' => 'text/html');
$res = $ua->request($req);
if ($res->is_success) {
$content=$res->headers_as_string.$res->content;
$real_url=$res->base;
$content=~/URL=([^\s]+)/;
$newurl=$1;
$real_url=~s/\?.*$//;
} else {
$real_url=$url;
}

}


sub PrintPage {
$body = qq~
<html>
<head>
<title>Loading...</title>
<script language="JavaScript">
setInterval("window.status='Loading...'",50);
</script>
<script language="JavaScript">
<!--
function UpdateLoader(){
document.all.Loader.innerHTML = '<a href="$real_url"><b>Click here if your browser sticks on this page</b></a>';
}
setTimeout("UpdateLoader()",3300);
//-->
</script>
<script language="JavaScript" type="text/JavaScript">
function forward() {
window.location.replace('$real_url');
}
setTimeout("forward()",1200);
</script>
</head>
<body bgcolor="silver">
<img src="$url" width="1" height="1" border="0">
<div align="center"><center>
<table border="0" width="100%" height="98%" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><div align="center"><center><table width="100%" border="0"
cellspacing="0">
<tr style="font-family: Verdana, Tahoma, Arial; font-size: 14pt">
<td align="center" ID="Loader"></td>
</tr>
<tr style="font-family: Verdana, Tahoma, Arial; font-size: 14pt">
<td align="center"><noscript><a href="$real_url"><font color="black"><b>Click here if
your browser sticks on this page</b></font></a></noscript></td>
</tr>
</table>
</center></div></td>
</tr>
</table>
</center></div>
</body>
</html>

~;

print "Content-type: text/html\n\n";
print $body;
exit;

}


Here's the read me file:

################################################## ###################
1. Open file cbnick.cgi with any plain text editor and edit following
parameter:

### specify here your default affiliate nickname
### it will be used if you don't add parameter a=youraffnick in the URL
$affnick = "youraffnick";

Save it.

################################################## ####################
2. Upload file cbnick.cgi to the http://www.yourdomain.com/cgi-bin/
folder in ASCII mode and chmod it 755

################################################## ####################
3. Now instead of regular hoplinks use the following one:

http://www.yourdomain.com/cgi-bin/cblink.cgi?v=vendornick

This way script will retreive real url of that vendor, then you will get
cookie to be credited for that sale and then it will redirect you to the
vendor's URL without ?hop=youraffnick at the end.

This script AdWords compatible because when visitor clicks Back button
he will be taken back to the referring site where he was coming from.

You can also dynamically add your affiliate nickname different from
the default one that you set while doing setup in file cblink.cgi

Just use the following link format

http://www.yourdomain.com/cgi-bin/cblink.cgi?v=vendornick&a=anotheraffiliatenickname

################################################## ####################
#cgi #script
  • Profile picture of the author lisag
    Originally Posted by jrapisarda View Post

    I finally found a link cloaking script that hides your clickbank id in the browser but it doesn't pass a tracking id.

    Can anyone help me with this script?
    Here is the script modified in it's entirety. Just copy and save.

    Search for ##Lisa## and ##/Lisa## to see what I changed.

    Not tested but should work. Report errors to me.

    #!/usr/bin/perl
    use CGI;
    use LWP::UserAgent;
    my $q=new CGI;

    ### specify here your default affiliate nickname. it will be used
    ### if you don't add parameter a=youraffnick in the URL (see README.TXT)
    $affnick = "cbnickname";
    $tid = "your tracking id" ##Lisa##
    ################################################## ##############################
    ### nothing to change below (yes there is) ##Lisa##
    ################################################## ##############################
    $v = $q->param("v");

    if (!$q->param("a")) {
    $a = $affnick;

    }else{
    $a = $q->param("a");
    }

    ##Lisa##
    $t = $q->param("t");

    if (!$q->param("t")) {
    $t = $tid;

    }else{
    $t = $q->param("t");
    }

    ##/LISA##

    if (!$q->param("v")){
    print "Content-type: text/html\n\n";
    print "Error: vendor nickname not specified\n";
    exit;
    }

    $url = "http://$a.$v.hop.clickbank.net/$t"; ##Lisa##
    GetLink($url);
    &PrintPage;

    sub GetLink {
    $nurl=shift;
    $id=shift;
    $ua = new LWP::UserAgent;
    $ua->agent("Mozilla/4.0");
    $req = new HTTP::Request 'GET' => $nurl;
    $req->header('Accept' => 'text/html');
    $res = $ua->request($req);
    if ($res->is_success) {
    $content=$res->headers_as_string.$res->content;
    $real_url=$res->base;
    $content=~/URL=([^\s]+)/;
    $newurl=$1;
    $real_url=~s/\?.*$//;
    } else {
    $real_url=$url;
    }

    }


    sub PrintPage {
    $body = qq~
    <html>
    <head>
    <title>Loading...</title>
    <script language="JavaScript">
    setInterval("window.status='Loading...'",50);
    </script>
    <script language="JavaScript">
    <!--
    function UpdateLoader(){
    document.all.Loader.innerHTML = '<a href="$real_url"><b>Click here if your browser sticks on this page</b></a>';
    }
    setTimeout("UpdateLoader()",3300);
    //-->
    </script>
    <script language="JavaScript" type="text/JavaScript">
    function forward() {
    window.location.replace('$real_url');
    }
    setTimeout("forward()",1200);
    </script>
    </head>
    <body bgcolor="silver">
    <img src="$url" width="1" height="1" border="0">
    <div align="center"><center>
    <table border="0" width="100%" height="98%" cellspacing="0" cellpadding="0">
    <tr>
    <td align="center"><div align="center"><center><table width="100%" border="0"
    cellspacing="0">
    <tr style="font-family: Verdana, Tahoma, Arial; font-size: 14pt">
    <td align="center" ID="Loader"></td>
    </tr>
    <tr style="font-family: Verdana, Tahoma, Arial; font-size: 14pt">
    <td align="center"><noscript><a href="$real_url"><font color="black"><b>Click here if
    your browser sticks on this page</b></font></a></noscript></td>
    </tr>
    </table>
    </center></div></td>
    </tr>
    </table>
    </center></div>
    </body>
    </html>

    ~;

    print "Content-type: text/html\n\n";
    print $body;
    exit;

    }



    Here's the read me file:

    ################################################## ###################
    1. Open file cbnick.cgi with any plain text editor and edit following
    parameter:

    ### specify here your default affiliate nickname
    ### it will be used if you don't add parameter a=youraffnick in the URL
    $affnick = "youraffnick";

    ##Lisa##
    ### specify here your default tracking ID
    ### it will be used if you don't add parameter t=tracking id in the URL

    $tid = "your tracking id";
    ##/Lisa##
    Save it.

    ################################################## ####################
    2. Upload file cbnick.cgi to the http://www.yourdomain.com/cgi-bin/
    folder in ASCII mode and chmod it 755

    ################################################## ####################
    3. Now instead of regular hoplinks use the following one:

    http://www.yourdomain.com/cgi-bin/cb...ick&t=tracking ID ##Lisa##

    This way script will retreive real url of that vendor, then you will get
    cookie to be credited for that sale and then it will redirect you to the
    vendor's URL without ?hop=youraffnick at the end.

    This script AdWords compatible because when visitor clicks Back button
    he will be taken back to the referring site where he was coming from.

    You can also dynamically add your affiliate nickname different from
    the default one that you set while doing setup in file cblink.cgi

    Just use the following link format

    http://www.yourdomain.com/cgi-bin/cb...iliatenickname
    Signature

    -- Lisa G

    {{ DiscussionBoard.errors[1634464].message }}
    • Profile picture of the author jrapisarda
      Thank you so much! I'll give it a shot and get back to you!
      {{ DiscussionBoard.errors[1634470].message }}
  • Profile picture of the author lisag
    Oops!

    Change:

    $url = "http://$a.$v.hop.clickbank.net/$t"; ##Lisa##

    to

    $url = "http://$a.$v.hop.clickbank.net/?tid=$t"; ##Lisa##
    Signature

    -- Lisa G

    {{ DiscussionBoard.errors[1634484].message }}
    • Profile picture of the author jrapisarda
      Ok... I'll give it a shot.
      {{ DiscussionBoard.errors[1634490].message }}
  • Profile picture of the author jrapisarda
    I'm getting a... 500 Internal Server Error

    I tried it with and without adding the tracking id into the code ($tid = "td001" ##Lisa##) using these formats:

    http://www.yourdomain.com/cgi-bin/cb...i?v=vendorname

    http://www.yourdomain.com/cgi-bin/cb...e&t=trackingid

    Is this set up to run with or with out adding info to: $tid = "fb001" ##Lisa##
    {{ DiscussionBoard.errors[1634540].message }}
    • Profile picture of the author chaos69
      You need to add a semicolon.

      $affnick = "cbnickname";
      $tid = "your tracking id" ##Lisa##


      You need to add one on the second line there.

      $affnick = "cbnickname";
      $tid = "your tracking id"; ## <---- RIGHT HERE


      [use strict; would also be a good idea]
      Signature
      Best Ways To Make Money Online

      Eight bytes walk into a bar. The bartender asks, “Can I get you anything?”
      “Yeah,” reply the bytes. “Make us a double.”
      {{ DiscussionBoard.errors[1634671].message }}
      • Profile picture of the author lisag
        Originally Posted by chaos69 View Post

        You need to add a semicolon.

        = "cbnickname";
        = "your tracking id" ##Lisa##


        You need to add one on the second line there.

        = "cbnickname";
        = "your tracking id"; ## <---- RIGHT HERE


        [use strict; would also be a good idea]
        Good catch! Thanks!
        Signature

        -- Lisa G

        {{ DiscussionBoard.errors[1635781].message }}
        • Profile picture of the author jrapisarda
          Thanks for the heads up! I finally got it working.

          I changed the ; in (= "your tracking id"; ## <---- RIGHT HERE )

          Plus:

          $tid = "your tracking id" ##Lisa## >>> to >>> $tid = "?tid=" ##Lisa##

          and...

          $url = "http://$a.$v.hop.clickbank.net/?tid=$t"; ##Lisa## >>> back to >>> $url = "http://$a.$v.hop.clickbank.net/$t"; ##Lisa##


          >>> Now when type the url in the browser you have to enter it like this:

          http://www.yourdomain.com/cgi-bin/cb...yourtrackingid

          Or use this to change your affiliate id:

          http://www.yourdomain.com/cgi-bin/cb...yourtrackingid

          Thanks so much for your help guys... Your awesome!

          Now I'm a little confused about the [ strict; ] thing!

          Where does it go and what does it do?
          {{ DiscussionBoard.errors[1636201].message }}
  • Profile picture of the author jrapisarda
    If anyone would like a copy of the modified edition... just pm me.
    {{ DiscussionBoard.errors[1636260].message }}
  • Profile picture of the author jrapisarda
    Cool... thanks!
    {{ DiscussionBoard.errors[1636290].message }}

Trending Topics