Parsing Amazon affiliate links in WordPress

Recently my team had problem with Amazon affiliate links on our web site.
On the web, we have wordpress installation and inside main content of web page we have some Amazon affiliate links that entered in the content few years ago and not working any more because Amazon changed API somehow. I searched the web for some new version of wordpress plug-in for new API version, because our old plug-in for displaying that links properly was turned off.

When links was formed like that, our site could never pass HTML validation, and also we had some click-able non-functional links in our content. It would be very hard work to parse every article inside database and remove that links from our content, because we have much content that would need checking and fixing.

I found the good plug-in that parses that links into proper formed links and making our links work, but there was one more problem to solve with that:

With regular Amazon API, like this new plug-in does, links are parsed with some included Javascript files that are linked directly from Amazon.com and small chunk of calling Javascript are included inside page to make it work.

But, what is happening when my colleagues develop iPhone application that reads content from web site’s rss feed are trying to make this links functional? They have to manually include all of this Javascript inside iPhone application and run that script locally from device.

I don’t think that is the best solution for us. So decided to make some own wordpress plug-in that will build that links with php and show them already parsed on web page and also inside feed to avoid Javascript parsing.

1 comment

Your email address will not be published. Required fields are marked *

Comment *

You may use these HTML tags and attributes: <a href="" title=""> <blockquote cite=""> <code> <del datetime=""> <em> <s> <strike> <strong>. You may use following syntax for source code: <pre><code>$current = "Inchoo";</code></pre>.