Judah Raine
Total posts: 332
21 Nov 2012 23:55

Just when you thought you were safe from a gazillion questions :D

I'm busy setting up our bookstore which is essentially linked to Amazon, Smashwords and Barnes and Noble. The first two are a cakewalk, but B & N use a linkshare affiliate system which has my little brain boggled.

I've done some research and it seems I can build an automatic link generator on my site. They are kind enough to provide sample code and from my limited understanding it seems that it might be possible to build this into my submission form, but the how to do it escapes me.

To explain: It's a simple form with following fields:

Book Cover

Book Blurb (summary)

Genre (filter)

Author Name

Book Name

Buy Amazon

Buy Smashwords

Buy Barnes and Noble

Adding the code to link the Amazon and Smashwords products has not posed a problem, just Barnes and Noble.

I have copied their tutorial and pasted below. I would really appreciate it if you could advise me on this. Thank you! (Another major learning curve)

PHP Sample Code

The Automated LinkGenerator is a Web Service that allows you to create LinkShare click links for any page on an advertiser's site. The code samples in this document demonstrate how to do this using PHP.

First, we need to create a page that allows the user to enter an Advertiser URL and an Advertiser ID, and to click on submit to get the results.

LinkShare Automated LinkGenerator

Sample to use the Automated LinkGenerator Web Service

Enter Advertiser URL:
Enter Advertiser ID:

Here is what this will look like:

We also need a page to send the query to the LinkShare server and process the response.

This is the sample code demonstrating how to do this:

http://getdeeplink.linksynergy.com/createcustomlink.shtml?token= &mid=&murl="; $url = "http://getdeeplink.linksynergy.com/createcustomlink.shtml"; $token = "5849bcc2fd3a5f3fd9dc2f7d9c08d8924143983a2745f393bf45534b171d9807"; //Change this to your token $advURL=$_POST["AdvURL"]; $MID=$_POST["mid"]; $resturl = $url."?"."token=".$token."&mid=".$MID."&murl=".$advURL; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $resturl); $response=curl_exec($ch); if (curl_errno($ch)) { print "Error: " . curl_error($ch); } else { print $response; curl_close($ch); } ?>

Here is the result this returns:

http://click.linksynergy.com/fs-bin/click?id=KgGHO0LswUU& ;subid=&offerid=102327.1&type=10&tmpid=2405&RD_PARM1=http%3A%2F%2Fwww.tigerdirect.com%2Fapplications%2FSearchTools%2Fitem-details.asp%3FEdpNo%3D2450694%2526Sku%3DA179-15081

You should be able to use this response to build an image link:

TigerDirect

Last Modified: 02 Mar 2014

Powered by Cobalt