sharelink auto link generator php

Hi there, I hope someone can assist me. I’m attempting to create a “bookstore” on our site which really is linked to Amazon, Barnes and Noble and Smashwords. I have no trouble with buy links for Amazon and Smashwords, but BN use Rakuten Linkshare which generates more complex links and insists that these are generated via linkshare itself. They have provided sample php in a tutorial, which I’ll add below. In essence I understand what they are suggesting, but need some practical assistance in how to implement this.

I would like to set this up as a module on my submission form page so that my authors can generate the link and then add it to the link field which will then display in my article. 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

I have managed to create the module. I have also managed to add the advertiser reference (Barnes and Noble) as pre-input, i.e. it is already in place in the link generator so authors don’t have to add it. My issue is that their sample code is in two sections. The first generates the form used to capture the information, the second the actual action in getting the link. If I add the information to the form and submit I get a 404 error. If I include the action part in the same module, I get an error message to the effect that the link is missing.

Their tutorial states essentially that two pages must be created for the two sets of php, but they do not indicate where or how. I have emailed them, but their response is that they do not supply support for php. :frowning:

I need to resolve this as a matter of extreme urgency and so would be grateful for any and all help. The tutorial is posted below.

Thank you!

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:

<?php "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%26Sku%3DA179-15081

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

TigerDirect

Sponsor our Newsletter | Privacy Policy | Terms of Service