I want to make so that you can download a affiliate-link (exe-file) direct from a "download"-button... but the problem is that this company (who provide the affiliatelink) doesn't have a solution when it's about "download direct".

I saw on a site (http://www.pokerlistings.com/betfred-poker) that apperently had a solution which makes a comletly white page to come up, and then the file (exe-file) comes directly for download.

I thought this was very smart, but I have not a clue how it'll work? Someone that now, and have the script?

10 Years
Discussion Span
Last Post by Vote4WillFree

Hm... Since I'm not so good at PHP I don't really know what to look for.

Someone that have the full script?


One line of code? How do you mean?

For the website to register it as a "download from me", it has to first connect to the affiliate adress ( http://banner.betfred.com/cgi-bin/redir.cgi?id=N&member=BlueLizard&profile=pmillion ), then to the download-adress ( http://banner.betfred.com/cgi-bin/SetupPoker.exe ).

That's the problem...

Someone that know how to do this?

What you are looking to do is set a cookie on the visitors computer that belongs to www.betfred.com. Only the site www.betfred.com can do this.

The cookie name is: banner_domainclick
The value for your affiliate url would be: BlueLizard,pm468x60,pmillion,http://www.daniweb.com/techtalkforums/post233015.html,*

Only the visitors computer can set this cookie for them and only when visiting betfred.com, so you cannot use PHP to set this cookie.

Also, JS cannot be used because the Domain restriction policies in setting cookies extend to JavaScript most any browser used on the web.

So your only choice is to use a hidden Iframe. This can set the cookie for you while the user is on your page. So when the user clicks on the download link, they already have your Affiliate Cookie on their computer.

When using this method, make sure it is within the terms and conditions of your affiliate membership. As you can see from the value of the cookie, BlueLizard,pm468x60,pmillion,http://www.daniweb.com/techtalkforums/post233015.html,*, it includes the referring page which the site is very likely to track.

If it goes against their terms, this could be worse off for you. You've been warned :)


You can write a java script to handle it by place the button within a form and having the form point to the script function. For example:

<Script language="Javascript">
function sendthis(f){
    var elm=f.elements['searchpedigree'];
        case 'search1':
        case 'search2':
    return false;
<form onsubmit="return sendthis(this);" action="sendto.php">
 <select name="searchpedigree">
 <option value="search1" selected>Pedigrees</option> 
<!-- Need this to go to pageA.html -->
 <option value="search2">Shipments</option> 
<!-- Need this to go to pageB.html -->
 <input type="submit">

Hope it helps.

Edited by Reverend Jim: Fixed formatting

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.