PHP - Link Cloaking Script

This script will mask the links on your website. This is important if you do any affiliate marketing. The major search engines will compare your links with their database of “known affiliates” and they will penalize you in the form of high minimum bids. Don’t worry though, this simple little script will “mask” (cloak) your links so that all the search engines (and users) see is something like www.yoursite.com/out.php?id=google

If you have problems copying and pasting the code below, you can download a copy here

Instructions

  1. Copy and paste the script below into an empty php file (our example was called out.php)
  2. Edit the section that says “edit your links here!”

    The format is as follows:
    “link_id” => “http//www.your_link_goes_here.com”

    where “link_id” is the id you pass in the URL like: www.yoursite.com/out.php?id=link_id

    Notice that there is a comma at the end of each line EXCEPT the last one!

<?php

// Link Cloaking Script -- ©2008 PlasticBrain
// www.plasticbrain.net
// ---------------------------------------------------------
// Edit the "links" section below. Format them like:
// "link_id" => "http//www.your_link_goes_here.com"
//
// where "link_id" is the id you pass in the URL
// www.yoursite.com/out.php?id=link_id
//
// if you need help visit us at www.plasticbrain.net
// ---------------------------------------------------------

$links = array(

// -- edit your links here! -- Notice that there is a comma after each entry EXCEPT the last one!!!

"1" => "http://www.your_link_here.com",
"2" => "http://www.another_link_here.com"

// -- Stop editing here! --
);

$id = $_GET['id'];

header(”Location:”.$links[$id]);
exit;

?>

download the script

link-cloak.php.txt

Post a Comment