<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" >

<channel>
	<title>Even the wrong words seem to rhyme &#187; amm</title>
	<atom:link href="http://www.kevinblake.co.uk/tag/amm/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kevinblake.co.uk</link>
	<description>a blog-life by Kevin Blake</description>
	<lastBuildDate>Sat, 04 Feb 2012 19:58:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Rescuscitating AMM with Amazon Web Service signed requests</title>
		<link>http://www.kevinblake.co.uk/rescuscitating-amm-with-amazon-web-service-signed-requests/656/</link>
		<comments>http://www.kevinblake.co.uk/rescuscitating-amm-with-amazon-web-service-signed-requests/656/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 12:19:39 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[amm]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.kevinblake.co.uk/rescuscitating-amm-with-amazon-web-service-signed-requests/656/</guid>
		<description><![CDATA[A few days ago Amazon added a requirement to their AWS that all requests to the service be signed, lest they be rejected. I&#8217;ve been using Sozu&#8217;s excellent Amazon Media Manager plugin for a while now to manage the currently reading list on this blog. It&#8217;s been a great way to keep track of exactly [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago Amazon added a requirement to their AWS that all <a href="http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/index.html?rest-signature.html" target="_blank">requests to the service be signed</a>, lest they be rejected.  I&#8217;ve been using Sozu&#8217;s excellent <a href="http://www.sozu.co.uk/software/amm/" target="_blank">Amazon Media Manager plugin</a> for a while now to manage the currently reading list on this blog.  It&#8217;s been a great way to keep track of exactly what I have read (avoiding the need to, like, remember), as well as masking my illiteracy by pasting a giant list of what is commonly known as airport trash.</p>
<p>Unfortunately, this is one plugin that hasn&#8217;t been updated in quite a while (after all, if ain&#8217;t broke&#8230;), so it broke.  Being the sort of developer that&#8217;s quite happy to pick up a block of php and hack it until it works, I stumbled across this blog entitled &#8216;<a href="http://mierendo.com/software/aws_signed_query/" target="_blank">Amazon® AWS HMAC signed request using PHP</a>&#8216;, which has a function to download.</p>
<p>So to fix AMM:</p>
<p>1. <a href="http://mierendo.com/software/aws_signed_query/aws_signed_request.zip">Download that file</a>, and copy the contents into the bottom of amm_parser.php.</p>
<p>2.  In the same file (amm_parser.php), replace your _setUrl function with this one:</p>
<div id="wpshdo_1" class="wp-synhighlighter-outer"><div id="wpshdt_1" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_1"></a><a id="wpshat_1" class="wp-synhighlighter-title" href="#codesyntax_1"  onClick="javascript:wpsh_toggleBlock(1)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_1" onClick="javascript:wpsh_code(1)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_1" onClick="javascript:wpsh_print(1)" title="Print code"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_1" class="wp-synhighlighter-inner" style="display: block;"><pre class="php" style="font-family:monospace;"><span class="kw2">function</span> <span class="sy0">&amp;</span>_setUrl<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
	<span class="co1">//Build URL from base URL and other required parameters</span>
	<span class="kw1">switch</span> <span class="br0">&#40;</span><span class="re0">$this</span><span class="sy0">-&gt;</span>_locale<span class="br0">&#41;</span> <span class="br0">&#123;</span>				
		<span class="kw1">case</span> <span class="st_h">'uk'</span><span class="sy0">:</span>
			<span class="re0">$region</span> <span class="sy0">=</span> <span class="st_h">'co.uk'</span><span class="sy0">;</span>
			<span class="kw1">break</span><span class="sy0">;</span>
		<span class="kw1">case</span> <span class="st_h">'de'</span><span class="sy0">:</span>
			<span class="re0">$region</span> <span class="sy0">.=</span> <span class="st_h">'de'</span><span class="sy0">;</span>
			<span class="kw1">break</span><span class="sy0">;</span>
		<span class="kw1">case</span> <span class="st_h">'jp'</span><span class="sy0">:</span>
			<span class="re0">$region</span> <span class="sy0">.=</span> <span class="st_h">'co.jp'</span><span class="sy0">;</span>
			<span class="kw1">break</span><span class="sy0">;</span>
		<span class="kw1">case</span> <span class="st_h">'fr'</span><span class="sy0">:</span>
			<span class="re0">$region</span> <span class="sy0">.=</span> <span class="st_h">'fr'</span><span class="sy0">;</span>
			<span class="kw1">break</span><span class="sy0">;</span>
		<span class="kw1">case</span> <span class="st_h">'ca'</span><span class="sy0">:</span>
			<span class="re0">$region</span> <span class="sy0">.=</span> <span class="st_h">'ca'</span><span class="sy0">;</span>
			<span class="kw1">break</span><span class="sy0">;</span>
		<span class="kw1">case</span> <span class="st_h">'us'</span><span class="sy0">:</span>
		<span class="kw1">default</span><span class="sy0">:</span>
			<span class="re0">$region</span> <span class="sy0">=</span> <span class="st_h">'com'</span><span class="sy0">;</span>
			<span class="kw1">break</span><span class="sy0">;</span>
	<span class="br0">&#125;</span>
	<span class="re0">$public_key</span> <span class="sy0">=</span> <span class="st0">&quot;&lt; &lt; Your Access Key ID &gt;&gt;&quot;</span><span class="sy0">;</span>
	<span class="re0">$private_key</span> <span class="sy0">=</span> <span class="st0">&quot;&lt; &lt; Your Secret Access Key &gt;&gt;&quot;</span><span class="sy0">;</span>
	<span class="re0">$url</span> <span class="sy0">=</span> aws_signed_request<span class="br0">&#40;</span><span class="re0">$region</span><span class="sy0">,</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span>
			<span class="st0">&quot;Operation&quot;</span><span class="sy0">=&gt;</span> <span class="st0">&quot;ItemSearch&quot;</span><span class="sy0">,</span>
			<span class="st0">&quot;Keywords&quot;</span> <span class="sy0">=&gt;</span> <span class="re0">$this</span><span class="sy0">-&gt;</span>_parameters<span class="br0">&#91;</span>Keywords<span class="br0">&#93;</span><span class="sy0">,</span>
			<span class="st0">&quot;ResponseGroup&quot;</span><span class="sy0">=&gt;</span><span class="re0">$this</span><span class="sy0">-&gt;</span>_parameters<span class="br0">&#91;</span>ResponseGroup<span class="br0">&#93;</span><span class="sy0">,</span>
			<span class="st0">&quot;SearchIndex&quot;</span> <span class="sy0">=&gt;</span> <span class="re0">$this</span><span class="sy0">-&gt;</span>_parameters<span class="br0">&#91;</span>SearchIndex<span class="br0">&#93;</span><span class="sy0">,</span>
			<span class="st0">&quot;AssociateTag&quot;</span> <span class="sy0">=&gt;</span> <a href="http://www.php.net/urlencode"><span class="kw3">urlencode</span></a><span class="br0">&#40;</span><span class="re0">$this</span><span class="sy0">-&gt;</span>_associate_tag<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">,</span>
			<span class="re0">$public_key</span><span class="sy0">,</span> <span class="re0">$private_key</span><span class="br0">&#41;</span><span class="sy0">;</span>
	<span class="kw1">return</span> <span class="re0">$url</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre></div></div>
<p>3.  Oddly enough, this new method requires a private secret key which Amazon recommends to not give to anyone.  So I&#8217;m not going to post mine here, even though it&#8217;s required for the plugin to work.  So before I ponder that particular nugget of madness, you&#8217;ll need to <a href="https://aws-portal.amazon.com/gp/aws/developer/account/index.html" target="_blank">sign up for an AWS developer account</a>, and find your own keys via the <a href="https://aws-portal.amazon.com/gp/aws/developer/account/index.html?ie=UTF8&#038;action=access-key" target="_blank">Access Identifiers</a> page.  These need to be added into the function above.</p>
<p>That should be enough to get you back up and running again, although selfishly I&#8217;ve only really tested it for my needs alone.  So please let me know if it works, or fails miserably.</p>
<p>For all the legal bits, I&#8217;m not at all affiliated with Amazon or Sozu &#8211; so please use at your own risk <img src='http://www.kevinblake.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.kevinblake.co.uk/rescuscitating-amm-with-amazon-web-service-signed-requests/656/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

