SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Nov 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    linkshare automated link generator errors

    Hi there,

    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. I have created a module for this as it seemed better to display a module on the form page rather than try to incorporate it into the form itself. I can get the module to display, and can get the advertiser number (Barnes and Noble) to be automatically included (rather than have my submitters try to remember this).

    The problem is that when I click on the submit button, I get a 404 page not found error. If I include the second set of code in the module, the module itself displays an error to the effect that the link is missing. While I do see that the sample code indicates creating two pages (at least, that's how I interpret it) there is no indication as to where or how these should be incorporated into the site. I have emailed them, but their response is that they do not support php script issues. I am an utter novice in all things php, learning as I go along, and this has me stymied.

    I would be most grateful for any and all assistance, as I need to have this in place three days ago Thank you!

    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.

    <html>
    <head>
    <title>LinkShare Automated LinkGenerator</title>
    </head>
    <body>
    <form method="post" action="AutoLinkGenProc.php">
    Sample to use the Automated LinkGenerator Web Service <br /><br />
    Enter Advertiser URLinput type="text" name="AdvURL"><br />
    Enter Advertiser IDinput type="text" name="mid"><br />
    <input type="submit" value="submit" name="submit">
    </form>
    </body>
    </html>

    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:

    <html>
    <body>

    <?php

    "http://getdeeplink.linksynergy.com/createcustomlink.shtml?token=<token-ID>&mid=<MID>&murl=<URL-from-merchant>";
    $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);
    }

    ?>
    </body>
    </html>

    Here is the result this returns:

    http://click.linksynergy.com/fs-bin/...u%3DA179-15081

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

    <a href=" 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"><IMG alt="TigerDirect" border="0" src="http://images.tigerdirect.com/skuimages/large/A179-1508CA-main-ca.jpg"></a>

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,500
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    It looks to me like that automated link generator is meant for you? So you can generate affiliate links to certain product pages, and then use that link in your website?

    So what exactly do you want to do? Give your users this form so they can create links?
    Or do you want to create links on the fly, for any advertiser url and id (that you get from somewhere) ?

  3. #3
    SitePoint Member
    Join Date
    Nov 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Guido, thanks for your response. Yes it is intended for use on my site. What I want is my authors to log in and post their book information using a specified form. That part is fine, there is no problem there. For the links to Barnes and Noble we have to use the automated link generator, otherwise I must manually get links for around 600 products!

    I am setting up the form so that the links are entered and then automatically display as a buy from B&N button in the article. To do this, we need the authors to enter the url to their book in the link generator and submit, which will generate the deep link that must then be entered as the buy link.

    My have therefore tried to set up the code as a module which displays on the form page itself so that the authors can generate the link while completing the form.

    I get the form ok, but when I enter a B & N url and submit I get a 404 page not found error.

    I then tried adding the second part of the above code to the module, but the form module then displays the error message that the link is missing.

    I'm obviously missing some kind of interaction with this form and my site but my experience with php is so limited that I cannot work out what exactly I'm missing and how to fix it.

    Thank you

  4. #4
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,500
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Could you post your code?

  5. #5
    SitePoint Member
    Join Date
    Nov 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is the code they recommend to create the form part

    <html>
    <head>
    <title>LinkShare Automated LinkGenerator</title>
    </head>
    <body>
    <form method="post" action="AutoLinkGenProc.php">
    Sample to use the Automated LinkGenerator Web Service <br /><br />
    Enter Advertiser URLinput type="text" name="AdvURL"><br />
    Enter Advertiser IDinput type="text" name="mid"><br />
    <input type="submit" value="submit" name="submit">
    </form>
    </body>
    </html>

    This is the code they use to send the query to the linkshare server and generate a response:

    <html>
    <body>

    <?php

    "http://getdeeplink.linksynergy.com/createcustomlink.shtml?token=<token-ID>&mid=<MID>&murl=<URL-from-merchant>";
    $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);
    }

    ?>
    </body>
    </html>

    I set this up in a module which allows for html and php. It displays as follows: Tried to add image but it won't upload. It can be seen at http://www.classicromancerevival.com at the bottom right. I have enabled the module so you can see


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •