Facebook Cloaking Script

As you probably already know old Facebook cloaking method not always work. They start testing new method without the traditional intern referral URL. So I’ve created clocking script + service to track reviewer’s IP addresses and share between users.

How it works:
You install script on your server, configure it and when Facebook intern come to review your ad from the traditional referral URL, script will send IP address, referral URL and user agent to tracking server. We will provide a daily updates of IP text file with fresh IP addresses. So your script always be up to date. More users use this script/service the more IP we will collect.

Installation and Configuration

1. Download Facebook Cloaking Script with Daily Updated IP Database.
2. Unpack the files to any folder on your web server. Make sure this line is in your php.ini file: allow_url_fopen = On
3. Edit the configuration file fbcloaking-config.php. You will see 2 PHP arrays $offers and $cloaked. $offers array for your non-cloaked URLs and $cloaked for cloaked links:). For same offer you have to use identical array keys in both arrays.

Example:

$offers = array(
 'offer-id1' => "http://trk.com/dl.php?t202id=123&t202kw=" . $_GET['ad'],
 'offer-id2' => "http://trk.com/dl.php?t202id=456&t202kw=" . $_GET['ad'],
 'offer-id3' => "http://anotheroffer.com/",
 
);
 
$cloaked = array(
    'offer-id1' => 'http://apps.facebook.com/visabusiness/',
    'offer-id2' => 'http://www.disney.com/',
    'offer-id3' => 'http://affiliateplex.com/',
 
);

As you can see you can pass through any query string parameters further to your tracking software.

Here is example how to configure cloaking script with prosper202/tracking202:

The best way to split testing your ads with prosper202/tracking202 and Facebook is using single destination URL and t202kw parameter.
For example you have created few ads with following URLs pointing to your cloaking script:
http://yourdomain.com/redirect.php?oid=offer1&ad=ad1
http://yourdomain.com/redirect.php?oid=offer1&ad=ad2
http://yourdomain.com/redirect.php?oid=offer2&ad=ad1
http://yourdomain.com/redirect.php?oid=offer3&ad=ad1

Then your configuration file should look something like this:

$offers = array(
 'offer1' => "http://trk.com/dl.php?t202id=123&t202kw=" . $_GET['ad'],
 'offer2' => "http://trk.com/dl.php?t202id=456&t202kw=" . $_GET['ad'],
 'offer3' => "http://trk.com/dl.php?t202id=789&t202kw=" . $_GET['ad'],
 
);
 
$cloaked = array(
    'offer1' => 'http://apps.facebook.com/visabusiness/',
    'offer2' => 'http://www.disney.com/',
    'offer3' => 'http://affiliateplex.com/',
 
);

If you don’t use tracking software you can just put offer or landing page URL into $offers array.

4. Daily update IP text file fbcloaking.txt from here.

Tags: ,

72 Responses to “Facebook Cloaking Script”

  1. Joe says:

    is FB cloaking legal? could they not sue you for creating a tool to fraud them?

  2. Alex says:

    It’s against their TOS but of course it’s legal :)

  3. Alex says:

    And it’s made not to fraud them. Have you tried to use their ad system, their approval process is random. One they they can approve absolutely legit ad, next disapprove it, etc. Google: “facebook ad approval experience”

  4. Yeah this pretty sweet! Just so you all know I’m going to be releasing a free facebook account creator soon. Will be adding this to my bag of goodies.

    Thanks!

  5. bradman says:

    this is gold!

    so let me get this straight.. going with the example above, if your destination URL for facebook is http://anotheroffer.com, when the reviewer/intern reviews the ad he will be cloaked redirect to http://affiliateplex.com.

    this correct?

  6. Jo Deer says:

    To MarketingNinja,

    I agree with what you said about cloaking being unethical, but what about the unethical reviewers from some of the big networks seeing your offers converting well and stealing your keywords/offers?

    When a reviewer knows you have done some good profitable campaigns and monitors what you are working on, it’s easy to ‘borrow’ some of the better campaigns that they are reviewing.

    Any comments on how to prevent this? Or have you experience this? It is kind of hard to prove except when the campaign starts out really well then dies a sudden death.

  7. michael says:

    is this still working?

  8. Steve says:

    Is this fbcloaking.txt IP list still updated daily?

    I just started making ads again recently and noticed a whole new batch of FB IP’s I’ve never seen before coming from FB’s end.

  9. emmanuel says:

    Hi Alex, could you be a bit more clear when it comes to “installing the script”? I configured fbcloaking-config.php correctly, now where do all these files go, on the root folder of the website?

  10. emmanuel says:

    Actually I think I’ve got it, do you simply paste the redirect.php code into the page?

    • Dave says:

      Emmanuel, I am just starting to use this script and have some of the same questions. Can you email me at dave.poly@gmail.com. I’d love to find out how this script is working for you and how you use it. Thanks!

  11. Jmoney says:

    Does this cloaker still work? Also how fresh is the IP list?

  12. matt says:

    where do i get the cloaked link?
    its like the last one or two steps are missing :s

  13. Aadm says:

    Works great, got my first ad approved no problem!

    Thanks

  14. Richard says:

    Is this still successful? How would I setup a cron job to automatically update the IPs each day?

    Thanks

  15. Kyle says:

    Hey I was just wondering if the IP list is still constantly updated? My ads are still getting denied.

  16. Dave says:

    Is this Facebook Cloaking Script still valid? I would like to look into this but I am no expert programmer.

    All you need to do is edit the fbcloaking-config.php file and then add these files to your server?

    Then when your Facebook ad URL goes to your site, the server files will redirect Facebook IP addresses before they can get to the landing page URL?

    Can somebody tell me if i’m right?

  17. Jon says:

    I don’t have access to my php.ini file and hosting will not enable allow_url_fopen = On.
    Is there another way to set this up?

Leave a Reply

PHVsPjxsaT48c3Ryb25nPndvb19hZHNfcm90YXRlPC9zdHJvbmc+IC0gdHJ1ZTwvbGk+PGxpPjxzdHJvbmc+d29vX2FkX2NvbnRlbnRfYWRzZW5zZTwvc3Ryb25nPiAtIDwvbGk+PGxpPjxzdHJvbmc+d29vX2FkX2NvbnRlbnRfZGlzYWJsZTwvc3Ryb25nPiAtIGZhbHNlPC9saT48bGk+PHN0cm9uZz53b29fYWRfY29udGVudF9pbWFnZTwvc3Ryb25nPiAtIGh0dHA6Ly93d3cud29vdGhlbWVzLmNvbS9hZHMvd29vdGhlbWVzLTQ2OHg2MC0yLmdpZjwvbGk+PGxpPjxzdHJvbmc+d29vX2FkX2NvbnRlbnRfdXJsPC9zdHJvbmc+IC0gaHR0cDovL3d3dy53b290aGVtZXMuY29tPC9saT48bGk+PHN0cm9uZz53b29fYWRfaW1hZ2VfMTwvc3Ryb25nPiAtIC9pbWFnZXMvbWVkaWF0cnVzdF8xMjV4MTI1LmdpZjwvbGk+PGxpPjxzdHJvbmc+d29vX2FkX2ltYWdlXzI8L3N0cm9uZz4gLSAvaW1hZ2VzLzEyNXgxMjVjb3BlYWMuZ2lmPC9saT48bGk+PHN0cm9uZz53b29fYWRfaW1hZ2VfMzwvc3Ryb25nPiAtIC9pbWFnZXMvMTI1eDEyNWNvcGVhYzIuZ2lmPC9saT48bGk+PHN0cm9uZz53b29fYWRfaW1hZ2VfNDwvc3Ryb25nPiAtIG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