<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-18200739</id><updated>2011-12-14T18:52:38.646-08:00</updated><category term='php amazon'/><title type='text'>Inside things</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://insidethings.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18200739/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://insidethings.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Horacix</name><uri>http://www.blogger.com/profile/10415816405843817174</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>3</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-18200739.post-6061378741837377876</id><published>2009-07-09T12:23:00.000-07:00</published><updated>2009-07-09T12:36:16.998-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php amazon'/><title type='text'></title><content type='html'>&lt;span style="font-size:180%;"&gt;Inside Signed AWS with PHP and SOAP&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Today I decided to update my AWS (Amazon Web Services) code (now called Product Advertising API) to use the new signed requests. Soon all request will need to be signed or else Amazon will just ignore them. I came with what I think to be a pretty elegant solution so I thought I could share it with the world. It uses the SOAP version of the service, and will only work on PHP &gt;= 5.1. Any comments will be appreciated.&lt;br /&gt;&lt;br /&gt; &lt;span style="font-family: courier new;"&gt;function aws_call($action, $body, $locale = 'US')&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    $access_key_id = 'your public access key';&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    $secret_access_key = 'your secret access key';&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    $locale_url = '';&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    if ($locale != 'US') {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;      $locale_url = "$locale/";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    $client = new SoapClient('http://ecs.amazonaws.com/AWSECommerceService/2009-06-01/' . $locale_url . 'AWSECommerceService.wsdl');&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    $timestamp = gmdate("Y-m-d\TH:i:s\Z");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    $signature = $action . $timestamp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    $signature = base64_encode(hash_hmac("sha256", $signature, $secret_access_key, True));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    $headers = array();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    $headers[] = new SoapHeader('http://security.amazonaws.com/doc/2007-01-01/',&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                                'AWSAccessKeyId',&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                                $access_key_id);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    $headers[] = new SoapHeader('http://security.amazonaws.com/doc/2007-01-01/',&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                                'Timestamp',&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                                $timestamp);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    $headers[] = new SoapHeader('http://security.amazonaws.com/doc/2007-01-01/',&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                                'Signature',&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                                $signature);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    $result = $client-&gt;__soapCall($action, array($body), NULL, $headers);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;An example for calling this function&lt;br /&gt;&lt;br /&gt;   &lt;span style="font-family: courier new;"&gt;$body = array (&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;      "SubscriptionId" =&gt; "your subs-ID",&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;      "Request" =&gt; array (&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        "ResponseGroup" =&gt; "EditorialReview,Images",&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        "ItemId" =&gt; $this-&gt;asin,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        "IdType" =&gt; "ASIN",&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;      )&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    );&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    $result = aws_call('ItemLookup', $body);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Hope you like it and find it useful.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18200739-6061378741837377876?l=insidethings.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://insidethings.blogspot.com/feeds/6061378741837377876/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18200739&amp;postID=6061378741837377876' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18200739/posts/default/6061378741837377876'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18200739/posts/default/6061378741837377876'/><link rel='alternate' type='text/html' href='http://insidethings.blogspot.com/2009/07/today-i-decided-to-update-my-aws-amazon.html' title=''/><author><name>Horacix</name><uri>http://www.blogger.com/profile/10415816405843817174</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18200739.post-113996436200539334</id><published>2006-02-14T16:42:00.000-08:00</published><updated>2006-02-14T16:46:02.006-08:00</updated><title type='text'></title><content type='html'>&lt;a href="http://photos1.blogger.com/blogger/7283/1774/1600/mas%20chica.jpg"&gt;&lt;img style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://photos1.blogger.com/blogger/7283/1774/320/mas%20chica.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Esta es una excelente foto del bosque de Santa Elena en Costa Rica. Me costò demasiado tomarla. Pero por eso quedò tan buena. Ahora sòlo falta que todo el mundo pueda admirarla. Si alguien desea esta foto para su colecciòn personal, gustoso podemos negociar los terminos para la licencia. Y si creen que puede ganar algùn concurso, por favor màndenme un mail y estarè muy agradecido.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18200739-113996436200539334?l=insidethings.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://insidethings.blogspot.com/feeds/113996436200539334/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18200739&amp;postID=113996436200539334' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18200739/posts/default/113996436200539334'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18200739/posts/default/113996436200539334'/><link rel='alternate' type='text/html' href='http://insidethings.blogspot.com/2006/02/esta-es-una-excelente-foto-del-bosque.html' title=''/><author><name>Horacix</name><uri>http://www.blogger.com/profile/10415816405843817174</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18200739.post-113008993375658913</id><published>2005-10-23T10:41:00.000-07:00</published><updated>2005-10-23T10:52:13.763-07:00</updated><title type='text'></title><content type='html'>Welcome to my new blog! Here I'll try to publish my thoughts and expreiences about one of my hobbies, putting things apart (mainly electronics), fixing stuff, etc.&lt;br /&gt;&lt;br /&gt;My goal is to become a reference for people wanting to be their own repair technicians but are too scared or doubtful to begin. It's true, you can screw hard and make things not work anymore, but my motto is: &lt;span style="font-weight: bold;"&gt;If it's already broken, let's try to fix it&lt;/span&gt; (There's nothing to loose :)&lt;br /&gt;&lt;br /&gt;Finally, a little disclaimer. Of course, these are only my experiences. I can't guarantee you will have the same results. And any damage you make to your stuff or yourself is entirely your responsiblity. And last but not least, always apply general common sense and play safe.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18200739-113008993375658913?l=insidethings.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://insidethings.blogspot.com/feeds/113008993375658913/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=18200739&amp;postID=113008993375658913' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18200739/posts/default/113008993375658913'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18200739/posts/default/113008993375658913'/><link rel='alternate' type='text/html' href='http://insidethings.blogspot.com/2005/10/welcome-to-my-new-blog-here-ill-try-to.html' title=''/><author><name>Horacix</name><uri>http://www.blogger.com/profile/10415816405843817174</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
