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.
FYI that links inside content look like this:
<a type="amzn"> “Jerusalem the Golden” performed by Rupert Gough–Malcolm Archer–Wells Cathedral Choir</a>
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:
Here is the code:
For parsing I used the SimpleHtmlDOM library that can be found on web for free download.
Now when displayed, Amazon links looks like this:
Feel free to use this code to make own plugin for AMZN links with ASIN code.