<?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/"
	>

<channel>
	<title>Money-Code &#187; api</title>
	<atom:link href="http://www.money-code.com/tag/api/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.money-code.com</link>
	<description>Coding For Online Success</description>
	<lastBuildDate>Tue, 15 Nov 2011 18:25:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>eBay API Change</title>
		<link>http://www.money-code.com/2011/01/ebay-api-change/</link>
		<comments>http://www.money-code.com/2011/01/ebay-api-change/#comments</comments>
		<pubDate>Tue, 18 Jan 2011 15:00:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[EPN]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[ebay]]></category>
		<category><![CDATA[finding api]]></category>

		<guid isPermaLink="false">http://www.money-code.com/?p=626</guid>
		<description><![CDATA[Most of you already know this, but I have been getting a few emails about this, so I&#8217;ll post it. eBay changed their API to the new Finding API. This will officially be unavailable aft October 2011. The new Finding API is MUCH better and you&#8217;ll definitely benefit by using it.  There is a migration [...]


Related posts:<ol><li><a href='http://www.money-code.com/2007/09/using-ebays-api-to-search-auctions-and-return-results/' rel='bookmark' title='Using eBay&#8217;s API to search auctions and return results'>Using eBay&#8217;s API to search auctions and return results</a></li>
<li><a href='http://www.money-code.com/2010/01/epn-change-to-rss/' rel='bookmark' title='EPN change to RSS'>EPN change to RSS</a></li>
<li><a href='http://www.money-code.com/2007/10/ebay-rss-querystringvariable-definitions/' rel='bookmark' title='eBay RSS querystring/variable definitions'>eBay RSS querystring/variable definitions</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.money-code.com%2F2011%2F01%2Febay-api-change%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2011%2F01%2Febay-api-change%2F&amp;source=hanjicode&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Most of you already know this, but I have been getting a few emails about this, so I&#8217;ll post it. eBay changed their API to the new Finding API. This will officially be unavailable aft October 2011. The new Finding API is MUCH better and you&#8217;ll definitely benefit by using it.  There is a migration guide available. Unfortunately, it does mean some major code changes. When I say code changes, I&#8217;m referring to the request and the variables returned from the response have different syntax, so it&#8217;s not too terrible on what needs to be done.</p>
<p>Here is the link to the migration guide:<br />
<a href="http://developer.ebay.com/devzone/finding/Concepts/map_FindItemsAdvanced_2_FindingService.html" target="_blank">http://developer.ebay.com/devzone/finding/Concepts/map_FindItemsAdvanced_2_FindingService.html</a></p>
<p>Hope this helps.</p>
<div style='clear:both'></div>

<p>Related posts:<ol><li><a href='http://www.money-code.com/2007/09/using-ebays-api-to-search-auctions-and-return-results/' rel='bookmark' title='Using eBay&#8217;s API to search auctions and return results'>Using eBay&#8217;s API to search auctions and return results</a></li>
<li><a href='http://www.money-code.com/2010/01/epn-change-to-rss/' rel='bookmark' title='EPN change to RSS'>EPN change to RSS</a></li>
<li><a href='http://www.money-code.com/2007/10/ebay-rss-querystringvariable-definitions/' rel='bookmark' title='eBay RSS querystring/variable definitions'>eBay RSS querystring/variable definitions</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.money-code.com/2011/01/ebay-api-change/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Finding BrowseNodes for Amazon API search (AWS)</title>
		<link>http://www.money-code.com/2009/09/finding-browsenodes-for-amazon-api-search-aws/</link>
		<comments>http://www.money-code.com/2009/09/finding-browsenodes-for-amazon-api-search-aws/#comments</comments>
		<pubDate>Wed, 23 Sep 2009 15:56:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[reviewazon]]></category>
		<category><![CDATA[web service]]></category>
		<category><![CDATA[wpreviewsite]]></category>

		<guid isPermaLink="false">http://www.money-code.com/?p=569</guid>
		<description><![CDATA[So, I&#8217;ve been hitting the Amazon sites real hard over the last month. With a combination of ReviewAZON, WPReviewSite and my own amazon store script, I&#8217;ve been picking niches and working on traffic. Today, I was looking at one of my good performing EPN store fronts, and I wanted to include Amazon products in there [...]


Related posts:<ol><li><a href='http://www.money-code.com/2009/08/amazon-product-api-signaturedoesnotmatch-error-response/' rel='bookmark' title='Amazon Product API: SignatureDoesNotMatch error response'>Amazon Product API: SignatureDoesNotMatch error response</a></li>
<li><a href='http://www.money-code.com/2009/05/amazon-associates-web-service-changes/' rel='bookmark' title='Amazon Associates Web Service Changes'>Amazon Associates Web Service Changes</a></li>
<li><a href='http://www.money-code.com/2009/08/understanding-the-amazon-product-advertising-api/' rel='bookmark' title='Understanding the Amazon Product Advertising API'>Understanding the Amazon Product Advertising API</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.money-code.com%2F2009%2F09%2Ffinding-browsenodes-for-amazon-api-search-aws%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2009%2F09%2Ffinding-browsenodes-for-amazon-api-search-aws%2F&amp;source=hanjicode&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><img class="alignleft" title="Amazon Web Services" src="http://developer.amazonwebservices.com/connect/images/amazon/logo_aws.gif" alt="" width="164" height="60" />So, I&#8217;ve been hitting the Amazon sites real hard over the last month. With a combination of <a href="http://www.money-code.com/target/reviewazon.php" target="_blank">ReviewAZON</a>, <a href="http://www.money-code.com/target/wpreviews.php" target="_blank">WPReviewSite</a> and my own amazon store script, I&#8217;ve been picking niches and working on traffic. Today, I was looking at one of my good performing EPN store fronts, and I wanted to include Amazon products in there as well. The problem I was having was getting it targeted to the sub category. I knew the SearchIndex, but couldn&#8217;t figure out how to get the proper BrowseNode of the sub category. The solution is to do a BrowseNodeLookup call.</p>
<p>To do this, you first need to determine the main BrowseNode, basically the number related to the main category where your product is located in. To get this number, you may be able to see it in the URL, or use this matrix to get the proper BrowseNode based off of country:</p>
<p><a href="http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/index.html?BrowseNodeIDs.html" target="_blank">http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/index.html?BrowseNodeIDs.html</a></p>
<p>Next, you need to query Amazon&#8217;s AWS and send this BrowseNode. You will receive a XML file containing all children related to this parent including name and BrowseNode.</p>
<p>Here is a basic function I wrote that will do a signed request for BrowseNodeLookup operation:</p>
<div class="dean_ch" style="white-space: wrap;"><span class="kw2">function</span> find_browse_node_aws_signed_request<span class="br0">&#40;</span><span class="re0">$region</span>, <span class="re0">$params</span>, <span class="re0">$public_key</span>, <span class="re0">$private_key</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="re0">$method</span> &nbsp; &nbsp; = <span class="st0">&quot;GET&quot;</span>;<br />
&nbsp; &nbsp; <span class="re0">$host</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&quot;ecs.amazonaws.&quot;</span>.<span class="re0">$region</span>;<br />
&nbsp; &nbsp; <span class="re0">$uri</span> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&quot;/onca/xml&quot;</span>;<br />
&nbsp; &nbsp; <span class="re0">$params</span><span class="br0">&#91;</span><span class="st0">&quot;Service&quot;</span><span class="br0">&#93;</span> &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&quot;AWSECommerceService&quot;</span>;<br />
&nbsp; &nbsp; <span class="re0">$params</span><span class="br0">&#91;</span><span class="st0">&quot;AWSAccessKeyId&quot;</span><span class="br0">&#93;</span> &nbsp; = <span class="re0">$public_key</span>;<br />
&nbsp; &nbsp; <span class="re0">$params</span><span class="br0">&#91;</span><span class="st0">&quot;Timestamp&quot;</span><span class="br0">&#93;</span> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; = <a href="http://www.php.net/gmdate"><span class="kw3">gmdate</span></a><span class="br0">&#40;</span><span class="st0">&quot;Y-m-d<span class="es0">\T</span>H:i:s<span class="es0">\Z</span>&quot;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="re0">$params</span><span class="br0">&#91;</span><span class="st0">&quot;Version&quot;</span><span class="br0">&#93;</span> &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&quot;2009-03-31&quot;</span>;<br />
&nbsp; &nbsp; <a href="http://www.php.net/ksort"><span class="kw3">ksort</span></a><span class="br0">&#40;</span><span class="re0">$params</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="re0">$canonicalized_query</span> = <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="kw1">foreach</span> <span class="br0">&#40;</span><span class="re0">$params</span> <span class="kw1">as</span> <span class="re0">$param</span>=&gt;<span class="re0">$value</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$param</span> &nbsp;= <a href="http://www.php.net/str_replace"><span class="kw3">str_replace</span></a><span class="br0">&#40;</span><span class="st0">&quot;%7E&quot;</span>, <span class="st0">&quot;~&quot;</span>, <a href="http://www.php.net/rawurlencode"><span class="kw3">rawurlencode</span></a><span class="br0">&#40;</span><span class="re0">$param</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$value</span> &nbsp;= <a href="http://www.php.net/str_replace"><span class="kw3">str_replace</span></a><span class="br0">&#40;</span><span class="st0">&quot;%7E&quot;</span>, <span class="st0">&quot;~&quot;</span>, <a href="http://www.php.net/rawurlencode"><span class="kw3">rawurlencode</span></a><span class="br0">&#40;</span><span class="re0">$value</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><span class="re0">$param</span> == <span class="st0">&#8216;ItemPage&#8217;</span> &amp;amp;&amp;amp; <span class="re0">$value</span> == <span class="st0">&#8216;x&#8217;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$canonicalized_query</span><span class="br0">&#91;</span><span class="br0">&#93;</span> = <span class="re0">$param</span>.<span class="st0">&quot;=&quot;</span>.<span class="re0">$i</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="kw1">else</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$canonicalized_query</span><span class="br0">&#91;</span><span class="br0">&#93;</span> = <span class="re0">$param</span>.<span class="st0">&quot;=&quot;</span>.<span class="re0">$value</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="re0">$canonicalized_query</span> = <a href="http://www.php.net/implode"><span class="kw3">implode</span></a><span class="br0">&#40;</span><span class="st0">&quot;&amp;amp;&quot;</span>, <span class="re0">$canonicalized_query</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="re0">$string_to_sign</span> = <span class="re0">$method</span>.<span class="st0">&quot;<span class="es0">\n</span>&quot;</span>.<span class="re0">$host</span>.<span class="st0">&quot;<span class="es0">\n</span>&quot;</span>.<span class="re0">$uri</span>.<span class="st0">&quot;<span class="es0">\n</span>&quot;</span>.<span class="re0">$canonicalized_query</span>;<br />
&nbsp; &nbsp; <span class="re0">$signature</span> = <a href="http://www.php.net/base64_encode"><span class="kw3">base64_encode</span></a><span class="br0">&#40;</span>hash_hmac<span class="br0">&#40;</span><span class="st0">&#8216;sha256&#8242;</span>, <span class="re0">$string_to_sign</span>, <span class="re0">$private_key</span>, <span class="kw2">true</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="re0">$signature</span> = <a href="http://www.php.net/str_replace"><span class="kw3">str_replace</span></a><span class="br0">&#40;</span><span class="st0">&quot;%7E&quot;</span>, <span class="st0">&quot;~&quot;</span>, <a href="http://www.php.net/rawurlencode"><span class="kw3">rawurlencode</span></a><span class="br0">&#40;</span><span class="re0">$signature</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="re0">$request</span> = <span class="st0">&quot;http://&quot;</span>.<span class="re0">$host</span>.<span class="re0">$uri</span>.<span class="st0">&quot;?&quot;</span>.<span class="re0">$canonicalized_query</span>.<span class="st0">&quot;&amp;amp;Signature=&quot;</span>.<span class="re0">$signature</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$ch</span>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = curl_init<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; curl_setopt<span class="br0">&#40;</span><span class="re0">$ch</span>, CURLOPT_RETURNTRANSFER, <span class="nu0">1</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; curl_setopt<span class="br0">&#40;</span><span class="re0">$ch</span>, CURLOPT_URL, <span class="re0">$request</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$response</span>&nbsp; &nbsp; &nbsp; &nbsp;= curl_exec<span class="br0">&#40;</span><span class="re0">$ch</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; curl_close<span class="br0">&#40;</span><span class="re0">$ch</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="re0">$response</span>;<br />
<span class="br0">&#125;</span></div>
<p>To call the function you would do something like this:</p>
<div class="dean_ch" style="white-space: wrap;"><span class="re0">$resp</span> &nbsp; = find_browse_node_aws_signed_request<span class="br0">&#40;</span><span class="re0">$country</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <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>=&gt;<span class="st0">&quot;BrowseNodeLookup&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;Service&quot;</span>=&gt;<span class="st0">&quot;AWSECommerceService&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;BrowseNodeId&quot;</span>=&gt;<span class="st0">&quot;111111111&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#41;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$pubKey</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$privKey</span><span class="br0">&#41;</span>;</div>
<p>$pubKey is your Associate Key ID (not your tracking ID) and the $privKey is your Secret AWS Key ID. You can do a var_dump($resp) to see the values of the returned array of values. After retrieving the BrowseNodeID, you can search within that category by passing &#8216;BrowseNode&#8217; to your ItemSearch API call. Hope this helps!</p>
<h4>Incoming search terms:</h4><ul><li>amazon api browsenode</li><li>amazon api browse nodes</li><li>amazon product advertising api browsenode</li><li>aws BrowseNode</li><li>amazon api nodes</li><li>aws browse nodes</li><li>BrowseNodes amazon api</li><li>amazon aws browsenode</li><li>amazon ecs get browsenodes</li><li>amazon browse node lookup</li></ul><div style='clear:both'></div>

<p>Related posts:<ol><li><a href='http://www.money-code.com/2009/08/amazon-product-api-signaturedoesnotmatch-error-response/' rel='bookmark' title='Amazon Product API: SignatureDoesNotMatch error response'>Amazon Product API: SignatureDoesNotMatch error response</a></li>
<li><a href='http://www.money-code.com/2009/05/amazon-associates-web-service-changes/' rel='bookmark' title='Amazon Associates Web Service Changes'>Amazon Associates Web Service Changes</a></li>
<li><a href='http://www.money-code.com/2009/08/understanding-the-amazon-product-advertising-api/' rel='bookmark' title='Understanding the Amazon Product Advertising API'>Understanding the Amazon Product Advertising API</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.money-code.com/2009/09/finding-browsenodes-for-amazon-api-search-aws/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Understanding the Amazon Product Advertising API</title>
		<link>http://www.money-code.com/2009/08/understanding-the-amazon-product-advertising-api/</link>
		<comments>http://www.money-code.com/2009/08/understanding-the-amazon-product-advertising-api/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 13:57:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Affiliate Marketing]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[quality click pricing]]></category>
		<category><![CDATA[reviewazon]]></category>
		<category><![CDATA[store fronts]]></category>

		<guid isPermaLink="false">http://www.money-code.com/?p=551</guid>
		<description><![CDATA[I&#8217;ve been working on some Amazon store fronts. With the recent chatter about the EPN Quality Click Pricing, I thought it would be good to focus on a few other sites while the dust settles. I have confidence that everything with EPN will work out, but this is a good reminder that one should stay [...]


Related posts:<ol><li><a href='http://www.money-code.com/2009/08/amazon-product-api-signaturedoesnotmatch-error-response/' rel='bookmark' title='Amazon Product API: SignatureDoesNotMatch error response'>Amazon Product API: SignatureDoesNotMatch error response</a></li>
<li><a href='http://www.money-code.com/2009/09/finding-browsenodes-for-amazon-api-search-aws/' rel='bookmark' title='Finding BrowseNodes for Amazon API search (AWS)'>Finding BrowseNodes for Amazon API search (AWS)</a></li>
<li><a href='http://www.money-code.com/2009/05/amazon-associates-web-service-changes/' rel='bookmark' title='Amazon Associates Web Service Changes'>Amazon Associates Web Service Changes</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.money-code.com%2F2009%2F08%2Funderstanding-the-amazon-product-advertising-api%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2009%2F08%2Funderstanding-the-amazon-product-advertising-api%2F&amp;source=hanjicode&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><img class="alignleft" title="Amazon Product Advertising API" src="http://developer.amazonwebservices.com/connect/images/amazon/logo_aws.gif" alt="" width="164" height="60" />I&#8217;ve been working on some Amazon store fronts. With the recent chatter about the <a href="http://www.money-code.com/2009/08/ebay-partner-network-quality-click-pricing-webinar-notes/" target="_blank">EPN Quality Click Pricing</a>, I thought it would be good to focus on a few other sites while the dust settles. I have confidence that everything with EPN will work out, but this is a good reminder that one should stay diversified.</p>
<p>I&#8217;m basically working on a few things. The first priority was to get my existing sites working after the<a href="http://www.money-code.com/2009/08/amazon-product-api-signaturedoesnotmatch-error-response/" target="_blank"> signed authentication change</a> which happened on August 15th. The next priority was to find a new blog plugin that would handle Amazon products nicely. I found <a href="http://www.money-code.com/2009/08/review-of-reviewazon/" target="_blank">ReviewAzon</a>, which fits my needs perfectly for posting products, but I needed a good &#8216;store front&#8217; script or way to include this with my <a href="http://www.money-code.com/2009/08/review-of-reviewazon/" target="_blank">ReviewAzon</a> sites.</p>
<p>I found <a href="http://wordpress.org/extend/plugins/amazon-niche-store/screenshots/" target="_blank">Amazon Niche Store</a>, which is free, and it looks similar to my various store fronts, but I wasn&#8217;t happy about the results being returned from the author&#8217;s server. So I figured I need to modify the plugin and do the lookup and presentation on my own. The author also displayed his tracking code 10% of the time (which he states). This was a fun project, since I&#8217;ve never worked on a plugin and it seems lately I&#8217;ve been doing a lot of WordPress stuff.</p>
<p>I wanted to state that finding good documentation about the Amazon AWS or Product Advertising API is somewhat difficult (not sure why), but since I found the proper docs, I wanted to post them here. The <a href="http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/" target="_blank">Product Advertising API Developer Guide</a> is must have link if you&#8217;re going to be doing any work with the API, it gives you a complete run down of the Operations needed to ask the appropriate questions to Amazon and return products.</p>
<p>I was able to rewrite that plugin and include it within my <a href="http://www.money-code.com/2009/08/review-of-reviewazon/" target="_blank">ReviewAzon</a> sites by creating a category &#8216;stores&#8217; within the blogs. One immediate challenge I had with that plugin re-write was the ability of returning more than 10 products, which appears to be a very common problem. My solution, and not sure if it&#8217;s the best, is to loop through the requests to get multiple pages and adding them to a array. To save on additional calls I serialized the array and stored it in the WP options table based on keyword searched with a timestamp. If the timestamp is expired, it will do another lookup, etc.</p>
<p>If any of you have dealt with this in the past and has a better solution, please let me know!</p>
<h4>Incoming search terms:</h4><ul><li>Amazon Product Advertising API</li><li>amazon product advertising api categories</li><li>amazon product advertising api cost</li><li>amazon product advertising api php tutorial</li><li>amazon api save</li><li>amazon store api php</li><li>amazon store api</li><li>amazon product api tutorial using php</li><li>amazon product api php</li><li>amazone api storing products to database</li></ul><div style='clear:both'></div>

<p>Related posts:<ol><li><a href='http://www.money-code.com/2009/08/amazon-product-api-signaturedoesnotmatch-error-response/' rel='bookmark' title='Amazon Product API: SignatureDoesNotMatch error response'>Amazon Product API: SignatureDoesNotMatch error response</a></li>
<li><a href='http://www.money-code.com/2009/09/finding-browsenodes-for-amazon-api-search-aws/' rel='bookmark' title='Finding BrowseNodes for Amazon API search (AWS)'>Finding BrowseNodes for Amazon API search (AWS)</a></li>
<li><a href='http://www.money-code.com/2009/05/amazon-associates-web-service-changes/' rel='bookmark' title='Amazon Associates Web Service Changes'>Amazon Associates Web Service Changes</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.money-code.com/2009/08/understanding-the-amazon-product-advertising-api/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Amazon Product API: SignatureDoesNotMatch error response</title>
		<link>http://www.money-code.com/2009/08/amazon-product-api-signaturedoesnotmatch-error-response/</link>
		<comments>http://www.money-code.com/2009/08/amazon-product-api-signaturedoesnotmatch-error-response/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 04:18:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Affiliate Marketing]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[store fronts]]></category>
		<category><![CDATA[web services]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.money-code.com/?p=536</guid>
		<description><![CDATA[On August 15, 2009, all Product Advertising API developers were required to authenticate ALL calls using a hmac/sha256 signing token. For some reason, this was a major pain in the ass for me, but I finally got things to work. If you&#8217;re having trouble, and you&#8217;re using PHP5, this may help you. The first item [...]


Related posts:<ol><li><a href='http://www.money-code.com/2009/09/finding-browsenodes-for-amazon-api-search-aws/' rel='bookmark' title='Finding BrowseNodes for Amazon API search (AWS)'>Finding BrowseNodes for Amazon API search (AWS)</a></li>
<li><a href='http://www.money-code.com/2009/08/understanding-the-amazon-product-advertising-api/' rel='bookmark' title='Understanding the Amazon Product Advertising API'>Understanding the Amazon Product Advertising API</a></li>
<li><a href='http://www.money-code.com/2008/01/how-to-search-amazons-catalog-with-amazons-associate-web-service/' rel='bookmark' title='How to search Amazon&#8217;s catalog with Amazon&#8217;s Associate Web Service'>How to search Amazon&#8217;s catalog with Amazon&#8217;s Associate Web Service</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.money-code.com%2F2009%2F08%2Famazon-product-api-signaturedoesnotmatch-error-response%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2009%2F08%2Famazon-product-api-signaturedoesnotmatch-error-response%2F&amp;source=hanjicode&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><img class="alignleft" title="Amazon Web Services" src="http://developer.amazonwebservices.com/connect/images/amazon/logo_aws.gif" alt="" width="164" height="60" />On August 15, 2009, all Product Advertising API developers were required to authenticate ALL calls using a hmac/sha256 signing token. For some reason, this was a major pain in the ass for me, but I finally got things to work.</p>
<p>If you&#8217;re having trouble, and you&#8217;re using PHP5, this may help you.</p>
<p>The first item you&#8217;ll need is the &#8216;secret&#8217;. You need to log into the Amazon Web Services area (<a href="https://developer.amazonwebservices.com" target="_blank">https://developer.amazonwebservices.com</a>). After logging in (assuming you already have a account if you&#8217;re using their API), you need to hover over &#8216;Your Account&#8217;, and click &#8216;Access Identifiers&#8217;. Here you will see &#8216;Access Key ID&#8217; and &#8216;Secret Access Key&#8217;. We&#8217;ll be referring Access Key ID as the <strong>public key</strong> and Secret Access Key as the <strong>private key</strong> in a function provided below. Copy these two values and add them to your code somewhere.</p>
<p>You will need to ensure that PHP is built with hash support. You can verify this with by view info (&lt;?phpinfo()?&gt;). If hash support is there we can use the built in <a href="http://us3.php.net/manual/en/function.hash-hmac.php" target="_blank">hash_hmac() </a>function. The concept is pretty straight forward (eventhough, I&#8217;ve been fighting it all night prior to this post). You create a string, and &#8216;hash&#8217; it with our private key, then we pass the string to Amazon&#8217;s API, and they hash the same string with our private key. The value should be the same, and if so, we&#8217;re good. If something is off any where in that sequence you&#8217;ll be getting the dreaded &#8216;<strong>SignatureDoesNotMatch</strong>&#8216; message in your XML return.</p>
<p>I came across Ulrich Mierendorff&#8217;s function for sending a signed AWS request on the developer forum, and it was the only PHP code snippet that worked for me, so I need to pass it on. Below is the function:</p>
<div class="dean_ch" style="white-space: wrap;"><span class="kw2">function</span> aws_signed_request<span class="br0">&#40;</span><span class="re0">$region</span>, <span class="re0">$params</span>, <span class="re0">$public_key</span>, <span class="re0">$private_key</span><span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="coMULTI">/*<br />
&nbsp; &nbsp; Copyright (c) 2009 Ulrich Mierendorff</p>
<p>&nbsp; &nbsp; Permission is hereby granted, free of charge, to any person obtaining a<br />
&nbsp; &nbsp; copy of this software and associated documentation files (the &quot;Software&quot;),<br />
&nbsp; &nbsp; to deal in the Software without restriction, including without limitation<br />
&nbsp; &nbsp; the rights to use, copy, modify, merge, publish, distribute, sublicense,<br />
&nbsp; &nbsp; and/or sell copies of the Software, and to permit persons to whom the<br />
&nbsp; &nbsp; Software is furnished to do so, subject to the following conditions:</p>
<p>&nbsp; &nbsp; The above copyright notice and this permission notice shall be included in<br />
&nbsp; &nbsp; all copies or substantial portions of the Software.</p>
<p>&nbsp; &nbsp; THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br />
&nbsp; &nbsp; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br />
&nbsp; &nbsp; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL<br />
&nbsp; &nbsp; THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br />
&nbsp; &nbsp; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br />
&nbsp; &nbsp; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER<br />
&nbsp; &nbsp; DEALINGS IN THE SOFTWARE.<br />
&nbsp; &nbsp; */</span></p>
<p>&nbsp; &nbsp; <span class="coMULTI">/*<br />
&nbsp; &nbsp; Parameters:<br />
&nbsp; &nbsp; &nbsp; &nbsp; $region &#8211; the Amazon(r) region (ca,com,co.uk,de,fr,jp)<br />
&nbsp; &nbsp; &nbsp; &nbsp; $params &#8211; an array of parameters, eg. array(&quot;Operation&quot;=&gt;&quot;ItemLookup&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;ItemId&quot;=&gt;&quot;B000X9FLKM&quot;, &quot;ResponseGroup&quot;=&gt;&quot;Small&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; $public_key &#8211; your &quot;Access Key ID&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; $private_key &#8211; your &quot;Secret Access Key&quot;<br />
&nbsp; &nbsp; */</span></p>
<p>&nbsp; &nbsp; <span class="co1">// some paramters</span><br />
&nbsp; &nbsp; <span class="re0">$method</span> = <span class="st0">&quot;GET&quot;</span>;<br />
&nbsp; &nbsp; <span class="re0">$host</span> = <span class="st0">&quot;ecs.amazonaws.&quot;</span>.<span class="re0">$region</span>;<br />
&nbsp; &nbsp; <span class="re0">$uri</span> = <span class="st0">&quot;/onca/xml&quot;</span>;</p>
<p>&nbsp; &nbsp; <span class="co1">// additional parameters</span><br />
&nbsp; &nbsp; <span class="re0">$params</span><span class="br0">&#91;</span><span class="st0">&quot;Service&quot;</span><span class="br0">&#93;</span> = <span class="st0">&quot;AWSECommerceService&quot;</span>;<br />
&nbsp; &nbsp; <span class="re0">$params</span><span class="br0">&#91;</span><span class="st0">&quot;AWSAccessKeyId&quot;</span><span class="br0">&#93;</span> = <span class="re0">$public_key</span>;<br />
&nbsp; &nbsp; <span class="co1">// GMT timestamp</span><br />
&nbsp; &nbsp; <span class="re0">$params</span><span class="br0">&#91;</span><span class="st0">&quot;Timestamp&quot;</span><span class="br0">&#93;</span> = <a href="http://www.php.net/gmdate"><span class="kw3">gmdate</span></a><span class="br0">&#40;</span><span class="st0">&quot;Y-m-d<span class="es0">\T</span>H:i:s<span class="es0">\Z</span>&quot;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="co1">// API version</span><br />
&nbsp; &nbsp; <span class="re0">$params</span><span class="br0">&#91;</span><span class="st0">&quot;Version&quot;</span><span class="br0">&#93;</span> = <span class="st0">&quot;2009-03-31&quot;</span>;</p>
<p>&nbsp; &nbsp; <span class="co1">// sort the parameters</span><br />
&nbsp; &nbsp; <a href="http://www.php.net/ksort"><span class="kw3">ksort</span></a><span class="br0">&#40;</span><span class="re0">$params</span><span class="br0">&#41;</span>;</p>
<p>&nbsp; &nbsp; <span class="co1">// create the canonicalized query</span><br />
&nbsp; &nbsp; <span class="re0">$canonicalized_query</span> = <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="kw1">foreach</span> <span class="br0">&#40;</span><span class="re0">$params</span> <span class="kw1">as</span> <span class="re0">$param</span>=&gt;<span class="re0">$value</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$param</span> = <a href="http://www.php.net/str_replace"><span class="kw3">str_replace</span></a><span class="br0">&#40;</span><span class="st0">&quot;%7E&quot;</span>, <span class="st0">&quot;~&quot;</span>, <a href="http://www.php.net/rawurlencode"><span class="kw3">rawurlencode</span></a><span class="br0">&#40;</span><span class="re0">$param</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$value</span> = <a href="http://www.php.net/str_replace"><span class="kw3">str_replace</span></a><span class="br0">&#40;</span><span class="st0">&quot;%7E&quot;</span>, <span class="st0">&quot;~&quot;</span>, <a href="http://www.php.net/rawurlencode"><span class="kw3">rawurlencode</span></a><span class="br0">&#40;</span><span class="re0">$value</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$canonicalized_query</span><span class="br0">&#91;</span><span class="br0">&#93;</span> = <span class="re0">$param</span>.<span class="st0">&quot;=&quot;</span>.<span class="re0">$value</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="re0">$canonicalized_query</span> = <a href="http://www.php.net/implode"><span class="kw3">implode</span></a><span class="br0">&#40;</span><span class="st0">&quot;&amp;amp;&quot;</span>, <span class="re0">$canonicalized_query</span><span class="br0">&#41;</span>;</p>
<p>&nbsp; &nbsp; <span class="co1">// create the string to sign</span><br />
&nbsp; &nbsp; <span class="re0">$string_to_sign</span> = <span class="re0">$method</span>.<span class="st0">&quot;<span class="es0">\n</span>&quot;</span>.<span class="re0">$host</span>.<span class="st0">&quot;<span class="es0">\n</span>&quot;</span>.<span class="re0">$uri</span>.<span class="st0">&quot;<span class="es0">\n</span>&quot;</span>.<span class="re0">$canonicalized_query</span>;</p>
<p>&nbsp; &nbsp; <span class="co1">// calculate HMAC with SHA256 and base64-encoding</span><br />
&nbsp; &nbsp; <span class="re0">$signature</span> = <a href="http://www.php.net/base64_encode"><span class="kw3">base64_encode</span></a><span class="br0">&#40;</span>hash_hmac<span class="br0">&#40;</span><span class="st0">&#8216;sha256&#8242;</span>, <span class="re0">$string_to_sign</span>, <span class="re0">$private_key</span>, <span class="kw2">True</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</p>
<p>&nbsp; &nbsp; <span class="co1">// encode the signature for the request</span><br />
&nbsp; &nbsp; <span class="re0">$signature</span> = <a href="http://www.php.net/str_replace"><span class="kw3">str_replace</span></a><span class="br0">&#40;</span><span class="st0">&quot;%7E&quot;</span>, <span class="st0">&quot;~&quot;</span>, <a href="http://www.php.net/rawurlencode"><span class="kw3">rawurlencode</span></a><span class="br0">&#40;</span><span class="re0">$signature</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</p>
<p>&nbsp; &nbsp; <span class="co1">// create request</span><br />
&nbsp; &nbsp; <span class="re0">$request</span> = <span class="st0">&quot;http://&quot;</span>.<span class="re0">$host</span>.<span class="re0">$uri</span>.<span class="st0">&quot;?&quot;</span>.<span class="re0">$canonicalized_query</span>.<span class="st0">&quot;&amp;amp;Signature=&quot;</span>.<span class="re0">$signature</span>;</p>
<p>&nbsp; &nbsp; <span class="co1">// do request</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$ch</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = curl_init<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; curl_setopt<span class="br0">&#40;</span><span class="re0">$ch</span>, CURLOPT_RETURNTRANSFER, <span class="nu0">1</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; curl_setopt<span class="br0">&#40;</span><span class="re0">$ch</span>, CURLOPT_URL, <span class="re0">$request</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$response</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = curl_exec<span class="br0">&#40;</span><span class="re0">$ch</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; curl_close<span class="br0">&#40;</span><span class="re0">$ch</span><span class="br0">&#41;</span>;</p>
<p>&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="re0">$response</span> === <span class="kw2">False</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="kw2">False</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="kw1">else</span><br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// parse XML</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$pxml</span> = simplexml_load_string<span class="br0">&#40;</span><span class="re0">$response</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="re0">$pxml</span> === <span class="kw2">False</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="kw2">False</span>; <span class="co1">// no xml</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="re0">$pxml</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></div>
<p>To call the function you create a array of arguments and pass it to the function along with the keys values.</p>
<div class="dean_ch" style="white-space: wrap;"><span class="re0">$amazontag</span>&nbsp; &nbsp; &nbsp; = <span class="st0">&#8216;asdfasfd-20&#8242;</span>;<br />
<span class="re0">$public_key</span> = <span class="st0">&quot;asfdasdfasdfasfdasfda&quot;</span>;<br />
<span class="re0">$private_key</span> = <span class="st0">&quot;SECRETKEYasfdasdfasdfasfdasfda&quot;</span>;<br />
<span class="re0">$param</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <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>=&gt;<span class="st0">&quot;ItemSearch&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;IdType&quot;</span>=&gt;<span class="st0">&quot;ASIN&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;MerchantId&quot;</span>=&gt;<span class="st0">&quot;All&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;ResponseGroup&quot;</span>=&gt;<span class="st0">&quot;Large&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;SearchIndex&quot;</span>=&gt;<span class="re0">$searchindex</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;BrowseNode&quot;</span>=&gt;<span class="re0">$BrowseNode</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;Keywords&quot;</span>=&gt;<span class="re0">$safeQuery</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;AWSAccessKeyId&quot;</span>=&gt;<span class="re0">$amazontag</span><span class="br0">&#41;</span>;<br />
<span class="re0">$xml</span> &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; = aws_signed_request<span class="br0">&#40;</span><span class="st0">&quot;com&quot;</span>,<span class="re0">$param</span>, <span class="re0">$public_key</span>, <span class="re0">$private_key</span><span class="br0">&#41;</span>;</div>
<p>This worked perfectly for me, and got my Amazon sites back on line. Hope this helps!!</p>
<h4>Incoming search terms:</h4><ul><li>SignatureDoesNotMatch</li><li>amazon SignatureDoesNotMatch</li><li>aws SignatureDoesNotMatch</li><li>signaturedoesnotmatch amazon</li><li>&lt;Code&gt;SignatureDoesNotMatch&lt;/Code&gt;</li><li>AWS Error Code: SignatureDoesNotMatch</li><li>amazon aws SignatureDoesNotMatch</li><li>amazon api SignatureDoesNotMatch</li><li>amazon signaturedoesnotmatch error</li><li>SignatureDoesNotMatch mws</li></ul><div style='clear:both'></div>

<p>Related posts:<ol><li><a href='http://www.money-code.com/2009/09/finding-browsenodes-for-amazon-api-search-aws/' rel='bookmark' title='Finding BrowseNodes for Amazon API search (AWS)'>Finding BrowseNodes for Amazon API search (AWS)</a></li>
<li><a href='http://www.money-code.com/2009/08/understanding-the-amazon-product-advertising-api/' rel='bookmark' title='Understanding the Amazon Product Advertising API'>Understanding the Amazon Product Advertising API</a></li>
<li><a href='http://www.money-code.com/2008/01/how-to-search-amazons-catalog-with-amazons-associate-web-service/' rel='bookmark' title='How to search Amazon&#8217;s catalog with Amazon&#8217;s Associate Web Service'>How to search Amazon&#8217;s catalog with Amazon&#8217;s Associate Web Service</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.money-code.com/2009/08/amazon-product-api-signaturedoesnotmatch-error-response/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Monitor your sites &#8211; Watch your logs</title>
		<link>http://www.money-code.com/2009/07/monitor-your-sites-watch-your-logs/</link>
		<comments>http://www.money-code.com/2009/07/monitor-your-sites-watch-your-logs/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 17:00:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[EPN]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[ebay]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.money-code.com/?p=442</guid>
		<description><![CDATA[I manage a few servers dedicated solely to my affiliate marketing efforts. As part of my daily routine, I monitor logs and activity of those servers. I do this for to maintain a level of security, but I also do this to keep an eye out for issues related to my affiliate sites. Today for [...]


Related posts:<ol><li><a href='http://www.money-code.com/2007/09/using-ebays-api-to-search-auctions-and-return-results/' rel='bookmark' title='Using eBay&#8217;s API to search auctions and return results'>Using eBay&#8217;s API to search auctions and return results</a></li>
<li><a href='http://www.money-code.com/2009/08/amazon-product-api-signaturedoesnotmatch-error-response/' rel='bookmark' title='Amazon Product API: SignatureDoesNotMatch error response'>Amazon Product API: SignatureDoesNotMatch error response</a></li>
<li><a href='http://www.money-code.com/2010/01/pay-attention-to-your-roll-your-own-epn-sites/' rel='bookmark' title='Pay Attention to your Roll-Your-Own EPN sites'>Pay Attention to your Roll-Your-Own EPN sites</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.money-code.com%2F2009%2F07%2Fmonitor-your-sites-watch-your-logs%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2009%2F07%2Fmonitor-your-sites-watch-your-logs%2F&amp;source=hanjicode&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I manage a few servers dedicated solely to my affiliate marketing efforts. As part of my daily routine, I monitor logs and activity of those servers. I do this for to <a href="http://www.money-code.com/2009/07/thinking-about-security-for-affiliate-marketing/" target="_self">maintain a level of security</a>, but I also do this to keep an eye out for issues related to my affiliate sites.</p>
<p>Today for example, I started seeing &#8216;Warnings&#8217; about undefined variables related to a eBay API processing script. This variable is defined when the server successfully communicated with eBay&#8217;s API and it then fills a array. The array was never created, yet, there were no errors with the API communication? This was odd, so I started to do some debugging.</p>
<p>I &#8216;echoed&#8217; the response and saw the following:</p>
<div class="dean_ch" style="white-space: wrap;">object<span class="br0">&#40;</span>SimpleXMLElement<span class="br0">&#41;</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span><br />
&nbsp; <span class="kw2">public</span> <span class="st0">&#8216;Timestamp&#8217;</span> =&gt; string <span class="st0">&#8217;2009-07-12T15:21:46.575Z&#8217;</span> <span class="br0">&#40;</span>length=<span class="nu0">24</span><span class="br0">&#41;</span><br />
&nbsp; <span class="kw2">public</span> <span class="st0">&#8216;Ack&#8217;</span> =&gt; string <span class="st0">&#8216;Failure&#8217;</span> <span class="br0">&#40;</span>length=<span class="nu0">7</span><span class="br0">&#41;</span><br />
&nbsp; <span class="kw2">public</span> <span class="st0">&#8216;Errors&#8217;</span> =&gt;<br />
&nbsp; &nbsp; object<span class="br0">&#40;</span>SimpleXMLElement<span class="br0">&#41;</span><span class="br0">&#91;</span><span class="nu0">2</span><span class="br0">&#93;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw2">public</span> <span class="st0">&#8216;ShortMessage&#8217;</span> =&gt; string <span class="st0">&#8216;Auth token is hard expired.&#8217;</span> <span class="br0">&#40;</span>length=<span class="nu0">27</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw2">public</span> <span class="st0">&#8216;LongMessage&#8217;</span> =&gt; string <span class="st0">&#8216;Auth token is hard expired, User needs to generate a new token for this application.&#8217;</span> <span class="br0">&#40;</span>length=<span class="nu0">84</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw2">public</span> <span class="st0">&#8216;ErrorCode&#8217;</span> =&gt; string <span class="st0">&#8217;932&#8242;</span> <span class="br0">&#40;</span>length=<span class="nu0">3</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw2">public</span> <span class="st0">&#8216;SeverityCode&#8217;</span> =&gt; string <span class="st0">&#8216;Error&#8217;</span> <span class="br0">&#40;</span>length=<span class="nu0">5</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw2">public</span> <span class="st0">&#8216;ErrorClassification&#8217;</span> =&gt; string <span class="st0">&#8216;RequestError&#8217;</span> <span class="br0">&#40;</span>length=<span class="nu0">12</span><span class="br0">&#41;</span><br />
&nbsp; <span class="kw2">public</span> <span class="st0">&#8216;Version&#8217;</span> =&gt; string <span class="st0">&#8217;623&#8242;</span> <span class="br0">&#40;</span>length=<span class="nu0">3</span><span class="br0">&#41;</span><br />
&nbsp; <span class="kw2">public</span> <span class="st0">&#8216;Build&#8217;</span> =&gt; string <span class="st0">&#8216;e623__Bundled_9520957_R1&#8242;</span> <span class="br0">&#40;</span>length=<span class="nu0">24</span><span class="br0">&#41;</span><br />
&nbsp; <span class="kw2">public</span> <span class="st0">&#8216;HasMoreItems&#8217;</span> =&gt; string <span class="st0">&#8216;false&#8217;</span> <span class="br0">&#40;</span>length=<span class="nu0">5</span><span class="br0">&#41;</span></div>
<p>Ah, so my authToken had expired. I didn&#8217;t even know they expired. Logging into eBay&#8217;s developer area, I saw that the token expired yesterday (7/11). The bottom line, is that I have many sites communicating to eBay using the API system there, and if I didn&#8217;t monitor my logs, I would have missed this. I&#8217;ll be re-writing my API function to alert on Ack=failure to avoid this. Normally, I was just looking at &#8216;complete&#8217; failure in the communication string.</p>
<div style='clear:both'></div>

<p>Related posts:<ol><li><a href='http://www.money-code.com/2007/09/using-ebays-api-to-search-auctions-and-return-results/' rel='bookmark' title='Using eBay&#8217;s API to search auctions and return results'>Using eBay&#8217;s API to search auctions and return results</a></li>
<li><a href='http://www.money-code.com/2009/08/amazon-product-api-signaturedoesnotmatch-error-response/' rel='bookmark' title='Amazon Product API: SignatureDoesNotMatch error response'>Amazon Product API: SignatureDoesNotMatch error response</a></li>
<li><a href='http://www.money-code.com/2010/01/pay-attention-to-your-roll-your-own-epn-sites/' rel='bookmark' title='Pay Attention to your Roll-Your-Own EPN sites'>Pay Attention to your Roll-Your-Own EPN sites</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.money-code.com/2009/07/monitor-your-sites-watch-your-logs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FTP&#8217;ing files from CJ&#8217;s FTP server to your host</title>
		<link>http://www.money-code.com/2009/06/ftping-files-from-cjs-ftp-server-to-your-host/</link>
		<comments>http://www.money-code.com/2009/06/ftping-files-from-cjs-ftp-server-to-your-host/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 01:59:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[cj]]></category>
		<category><![CDATA[datafeed]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[<p>I had a few people email me about my <a href="http://www.money-code.com/node/119">Parsing XML CJ Product Feeds</a> article regarding how to FTP the file to your server. You can use various FTP function depending on how your PHP is configured. I used wget to grab the files. It was easier to gather all of my feeds. To do this, you'll need to use PHP's <a href="http://us2.php.net/manual/en/function.exec.php" target="_blank">exec() function</a> to execute the wget program on the server (assuming you have access and permissions to use wget via script).</p>

<p><code>
<?php
exec("wget -P/path/to/your/site/cj/files ftp://username:password@datatransfer.cj.com/outgoing/productcatalog/111111/*.*");
?>
</code></p>


Related posts:<ol><li><a href='http://www.money-code.com/2008/01/problems-fetching-cj-product-feeds-with-phps-ftp-functionality/' rel='bookmark' title='Problems fetching CJ Product Feeds with PHP&#8217;s FTP functionality'>Problems fetching CJ Product Feeds with PHP&#8217;s FTP functionality</a></li>
<li><a href='http://www.money-code.com/2009/06/geoip-scripts-php-and-javascript/' rel='bookmark' title='GeoIP Scripts PHP and JavaScript'>GeoIP Scripts PHP and JavaScript</a></li>
<li><a href='http://www.money-code.com/2007/10/cj-quick-stat-email-script/' rel='bookmark' title='CJ Quick Stat Email Script'>CJ Quick Stat Email Script</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.money-code.com%2F2009%2F06%2Fftping-files-from-cjs-ftp-server-to-your-host%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2009%2F06%2Fftping-files-from-cjs-ftp-server-to-your-host%2F&amp;source=hanjicode&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I had a few people email me about my <a href="http://www.money-code.com/node/119">Parsing XML CJ Product Feeds</a> article regarding how to FTP the file to your server. You can use various FTP function depending on how your PHP is configured. I used wget to grab the files. It was easier to gather all of my feeds. To do this, you&#8217;ll need to use PHP&#8217;s <a href="http://us2.php.net/manual/en/function.exec.php" target="_blank">exec() function</a> to execute the wget program on the server (assuming you have access and permissions to use wget via script).</p>
<div class="dean_ch" style="white-space: wrap;">
<span class="kw2">&lt;?php</span><br />
<a href="http://www.php.net/exec"><span class="kw3">exec</span></a><span class="br0">&#40;</span><span class="st0">&quot;wget -P/path/to/your/site/cj/files ftp://username:password@datatransfer.cj.com/outgoing/productcatalog/111111/*.*&quot;</span><span class="br0">&#41;</span>;<br />
<span class="kw2">?&gt;</span><br />
&nbsp;</div>
<p>This will log into the FTP server using the username:password values being passed. Please substitute this with your actual username and password. All files be sent to the path you specified with the -P argument. Please update this with a valid path on your system. If you don&#8217;t know what your directory structure is on CJ&#8217;s FTP server, you may need to contact CJ support or log in with a simple FTP client to see what your path is. My example is using &#8217;111111&#8242; is just a example.</p>
<p>Once you have the files downloaded, they may be like mine and are zipped or gzipped. You could use exec() again to unzip it or install a PHP extension to unzip this (dev-php5/pecl-zip). If you need example of this, I can try to help. My server is customized by me, so I&#8217;m using the pecl-zip extension for PHP.</p>
<p>hanji</p>
<h4>Incoming search terms:</h4><ul><li>cj ftp report datatransfer cj com</li><li>cj API to get ftp file</li><li>how to access cj ftp</li><li>how do i log into cj FTP?</li><li>ftp://USERNAME:PASSWORD@datatransfer cj com</li><li>ftp datatransfer cj php</li><li>download cj com feed to my server</li><li>client ftp cj com how to</li><li>cj ftp server</li><li>cj ftp file download scripr</li></ul><div style='clear:both'></div>

<p>Related posts:<ol><li><a href='http://www.money-code.com/2008/01/problems-fetching-cj-product-feeds-with-phps-ftp-functionality/' rel='bookmark' title='Problems fetching CJ Product Feeds with PHP&#8217;s FTP functionality'>Problems fetching CJ Product Feeds with PHP&#8217;s FTP functionality</a></li>
<li><a href='http://www.money-code.com/2009/06/geoip-scripts-php-and-javascript/' rel='bookmark' title='GeoIP Scripts PHP and JavaScript'>GeoIP Scripts PHP and JavaScript</a></li>
<li><a href='http://www.money-code.com/2007/10/cj-quick-stat-email-script/' rel='bookmark' title='CJ Quick Stat Email Script'>CJ Quick Stat Email Script</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.money-code.com/2009/06/ftping-files-from-cjs-ftp-server-to-your-host/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Amazon Associates Web Service Changes</title>
		<link>http://www.money-code.com/2009/05/amazon-associates-web-service-changes/</link>
		<comments>http://www.money-code.com/2009/05/amazon-associates-web-service-changes/#comments</comments>
		<pubDate>Fri, 08 May 2009 16:27:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Affiliate Marketing]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[api]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Looks like Amazon is making some changes to their API. First they're changing the name to 'Product Advertising API', which is fine with me. But it looks like they're changing how you make calls. Based on the email sent they're requiring authentication with each API call. Not sure what kind of impact, if any, this will cause. They are implementing this change on May 11 and will finish up by August 15th. 

I personally will want to wait until the last minute to ensure the bugs were worked out. Unfortunately, my earnings with Amazon are always low, so it'll be hard to gauge if something is wrong after the roll out.

Here is a portion of the letter sent out to associates related to the API:




Related posts:<ol><li><a href='http://www.money-code.com/2008/01/how-to-search-amazons-catalog-with-amazons-associate-web-service/' rel='bookmark' title='How to search Amazon&#8217;s catalog with Amazon&#8217;s Associate Web Service'>How to search Amazon&#8217;s catalog with Amazon&#8217;s Associate Web Service</a></li>
<li><a href='http://www.money-code.com/2009/08/understanding-the-amazon-product-advertising-api/' rel='bookmark' title='Understanding the Amazon Product Advertising API'>Understanding the Amazon Product Advertising API</a></li>
<li><a href='http://www.money-code.com/2007/10/cj-web-service-issues-unable-to-access-wsdl-update/' rel='bookmark' title='CJ web service issues &#8211; unable to access WSDL (UPDATE)'>CJ web service issues &#8211; unable to access WSDL (UPDATE)</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.money-code.com%2F2009%2F05%2Famazon-associates-web-service-changes%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2009%2F05%2Famazon-associates-web-service-changes%2F&amp;source=hanjicode&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Looks like Amazon is making some changes to their API. First they&#8217;re changing the name to &#8216;Product Advertising API&#8217;, which is fine with me. But it looks like they&#8217;re changing how you make calls. Based on the email sent they&#8217;re requiring authentication with each API call. Not sure what kind of impact, if any, this will cause. They are implementing this change on May 11 and will finish up by August 15th. </p>
<p>I personally will want to wait until the last minute to ensure the bugs were worked out. Unfortunately, my earnings with Amazon are always low, so it&#8217;ll be hard to gauge if something is wrong after the roll out.</p>
<p>Here is a portion of the letter sent out to associates related to the API:</p>
<blockquote><p>&#8220;In addition to the new name, signatures will be necessary to authenticate each call to the Product Advertising API.  This requirement will be phased in starting May 11, 2009, and by August 15, 2009, all calls to the Product Advertising API must be authenticated or they will not be processed.  For pointers on how you can easily authenticate requests to the Product Advertising API, please refer to the developer guide, available here (<a href="http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/" target="_blank">http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/</a>).&#8221;</p></blockquote>
<div style='clear:both'></div>

<p>Related posts:<ol><li><a href='http://www.money-code.com/2008/01/how-to-search-amazons-catalog-with-amazons-associate-web-service/' rel='bookmark' title='How to search Amazon&#8217;s catalog with Amazon&#8217;s Associate Web Service'>How to search Amazon&#8217;s catalog with Amazon&#8217;s Associate Web Service</a></li>
<li><a href='http://www.money-code.com/2009/08/understanding-the-amazon-product-advertising-api/' rel='bookmark' title='Understanding the Amazon Product Advertising API'>Understanding the Amazon Product Advertising API</a></li>
<li><a href='http://www.money-code.com/2007/10/cj-web-service-issues-unable-to-access-wsdl-update/' rel='bookmark' title='CJ web service issues &#8211; unable to access WSDL (UPDATE)'>CJ web service issues &#8211; unable to access WSDL (UPDATE)</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.money-code.com/2009/05/amazon-associates-web-service-changes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to search Amazon&#8217;s catalog with Amazon&#8217;s Associate Web Service</title>
		<link>http://www.money-code.com/2008/01/how-to-search-amazons-catalog-with-amazons-associate-web-service/</link>
		<comments>http://www.money-code.com/2008/01/how-to-search-amazons-catalog-with-amazons-associate-web-service/#comments</comments>
		<pubDate>Fri, 18 Jan 2008 21:58:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Affiliate Marketing]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[<p>This is a small tutorial on how you can retrieve products from Amazon's Associates Web Service. I'm not the biggest fan of Amazon's affiliate program. The biggest reason is the one day cookie. I like programs that produce results, and I've always struggled with this program. When I talk to others that do have success, it definitely seems like you need a large volume of visitors, and it appears to be quite seasonally dependent.</p>

<p>Regardless, I wanted to show how you can make calls against their web service. The first step is to be a Amazon associate (<a href="https://affiliate-program.amazon.com/" target="_blank">https://affiliate-program.amazon.com/</a>). Here you will get an associate tag (usually something-20). This allows you to receive commissions by creating widgets, etc. But we want to use the AWS (Amazon Web Service), so you must be a Amazon developer. So this step will involve us going to the Amazon Web Service web site (<a href="http://aws.amazon.com" target="_blank">http://aws.amazon.com</a>). After creating account you will need to create a token. Basically, this is a password used to login to Amazon's web service. Look for a button on the upper right hand section called 'Your Web Serices Account', click on AWS Access Identifiers. Look for something down in the content called Access Key ID. You may need to generate them. To make the calls we'll need the Access Key AND your Amazon associate tag.</p>



Related posts:<ol><li><a href='http://www.money-code.com/2009/09/finding-browsenodes-for-amazon-api-search-aws/' rel='bookmark' title='Finding BrowseNodes for Amazon API search (AWS)'>Finding BrowseNodes for Amazon API search (AWS)</a></li>
<li><a href='http://www.money-code.com/2007/09/simple-script-for-connecting-to-commission-junctions-product-web-service-and-populating-a-local-database/' rel='bookmark' title='Simple script for connecting to Commission Junction&#8217;s Product Web Service and populating a local database'>Simple script for connecting to Commission Junction&#8217;s Product Web Service and populating a local database</a></li>
<li><a href='http://www.money-code.com/2009/05/amazon-associates-web-service-changes/' rel='bookmark' title='Amazon Associates Web Service Changes'>Amazon Associates Web Service Changes</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.money-code.com%2F2008%2F01%2Fhow-to-search-amazons-catalog-with-amazons-associate-web-service%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2008%2F01%2Fhow-to-search-amazons-catalog-with-amazons-associate-web-service%2F&amp;source=hanjicode&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>This is a small tutorial on how you can retrieve products from Amazon&#8217;s Associates Web Service. I&#8217;m not the biggest fan of Amazon&#8217;s affiliate program. The biggest reason is the one day cookie. I like programs that produce results, and I&#8217;ve always struggled with this program. When I talk to others that do have success, it definitely seems like you need a large volume of visitors, and it appears to be quite seasonally dependent.</p>
<p>Regardless, I wanted to show how you can make calls against their web service. The first step is to be a Amazon associate (<a href="https://affiliate-program.amazon.com/" target="_blank">https://affiliate-program.amazon.com/</a>). Here you will get an associate tag (usually something-20). This allows you to receive commissions by creating widgets, etc. But we want to use the AWS (Amazon Web Service), so you must be a Amazon developer. So this step will involve us going to the Amazon Web Service web site (<a href="http://aws.amazon.com" target="_blank">http://aws.amazon.com</a>). After creating account you will need to create a token. Basically, this is a password used to login to Amazon&#8217;s web service. Look for a button on the upper right hand section called &#8216;Your Web Serices Account&#8217;, click on AWS Access Identifiers. Look for something down in the content called Access Key ID. You may need to generate them. To make the calls we&#8217;ll need the Access Key AND your Amazon associate tag.</p>
<p><!--break--></p>
<p>Now.. to the code.</p>
<p>The first thing we need to understand is the search index. Basically, these are the categories at Amazon. This tells the web service what category we want to search for products. If you want all products from multiple categories, use &#8216;Blended&#8217; as the search index. Here is a link that describes Amazon&#8217;s search index (<a href="http://docs.amazonwebservices.com/AWSECommerceService/2007-04-04/DG/SearchIndices.html" target="_blank">http://docs.amazonwebservices.com/AWSECommerceService/2007-04-04/DG/SearchIndices.html</a>).</p>
<p>Below is a listing of Search Indexes at Amazon:</p>
<p><code><br />
Apparel<br />
Automotive<br />
Baby<br />
Beauty<br />
Blended<br />
Books<br />
Classical<br />
DigitalMusic<br />
DVD<br />
Electronics<br />
ForeignBooks<br />
GourmetFood<br />
HealthPersonalCare<br />
Hobbies<br />
HomeGarden<br />
Jewelry<br />
Kitchen<br />
Magazines<br />
Merchants<br />
Miscellaneous<br />
Music<br />
MusicalInstruments<br />
MusicTracks<br />
OfficeProducts<br />
OutdoorLiving<br />
PCHardware<br />
PetSupplies<br />
Photo<br />
Software<br />
SoftwareVideoGames<br />
SportingGoods<br />
Tools<br />
Toys<br />
VHS<br />
Video<br />
VideoGames<br />
Wireless<br />
WirelessAccessories<br />
</code></p>
<p>Now we need to assemble a few variables for our web service call. They make it extremely easy using their REST method. We just need to assemble a querystring with our value. For this example, I want to search the &#8216;toys&#8217; index and look for Star Wars items.</p>
<div class="dean_ch" style="white-space: wrap;">
<span class="kw2">&lt;?php</span><br />
<span class="re0">$searchIndex</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&#8216;toys&#8217;</span>;<br />
<span class="re0">$amazonAssoc</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&#8216;something-20&#8242;</span>;<br />
<span class="re0">$amazonId</span>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&#8216;SOMELONGSTRING&#8217;</span>;<br />
<span class="re0">$query</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <a href="http://www.php.net/urlencode"><span class="kw3">urlencode</span></a><span class="br0">&#40;</span><span class="st0">&#8216;star wars&#8217;</span><span class="br0">&#41;</span>;<br />
<span class="re0">$url</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&#8216;http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&amp;amp;IdType=ASIN&amp;amp;ResponseGroup=Large&amp;amp;SearchIndex=&quot; . &nbsp;$searchIndex . &quot;&amp;amp;Operation=ItemSearch&amp;amp;Keywords=&quot; . $query . &quot;&amp;amp;AWSAccessKeyId=&quot; . $amazonId . &quot;&amp;amp;AssociateTag=&quot; . $amazonAssoc . &quot;&amp;amp;Version=2007-05-14&#8242;</span>&lt;/code&gt;<br />
<span class="kw2">?&gt;</span><br />
&nbsp;</div>
<p>After creating our querystring, we&#8217;re going to use cURL to send the request and retrieve an XML result back from the server.</p>
<div class="dean_ch" style="white-space: wrap;">
<span class="co1">// make cURL request&lt;/code&gt;</span></p>
<p><span class="re0">$ch</span> = curl_init<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
curl_setopt<span class="br0">&#40;</span><span class="re0">$ch</span>, CURLOPT_RETURNTRANSFER, <span class="nu0">1</span><span class="br0">&#41;</span>;<br />
curl_setopt<span class="br0">&#40;</span><span class="re0">$ch</span>, CURLOPT_URL, <span class="re0">$whaturl</span><span class="br0">&#41;</span>;<br />
<span class="re0">$data</span> = curl_exec<span class="br0">&#40;</span><span class="re0">$ch</span><span class="br0">&#41;</span>;<br />
curl_close<span class="br0">&#40;</span><span class="re0">$ch</span><span class="br0">&#41;</span>;<br />
&nbsp;</div>
<p>Now we have something back from cURL. We&#8217;ll use PHP5&#8242;s ximplexml_load_string() function to create a nice XML array. From here we just simply loop through the nodes and grab values we need.</p>
<div class="dean_ch" style="white-space: wrap;">
<span class="re0">$xml</span> &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = simplexml_load_string<span class="br0">&#40;</span><span class="re0">$data</span><span class="br0">&#41;</span>;<br />
<span class="re0">$mark</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="re0">$xml</span>-&gt;<span class="me1">TotalPages</span>;<br />
<span class="re0">$error</span> &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="re0">$xml</span>-&gt;<span class="me1">ErrorMsg</span>;</p>
<p>
<span class="co1">// check to see if we have items</span><br />
<span class="kw1">if</span><span class="br0">&#40;</span><span class="re0">$xml</span>-&gt;<span class="me1">Items</span>-&gt;<span class="me1">Item</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
<span class="re0">$x</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="nu0">0</span>; <span class="co1">// set counter to handle display amounts</span><br />
<span class="kw1">foreach</span> <span class="br0">&#40;</span><span class="re0">$xml</span>-&gt;<span class="me1">Items</span>-&gt;<span class="me1">Item</span> <span class="kw1">as</span> <span class="re0">$item</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
<span class="kw1">if</span> <span class="br0">&#40;</span><span class="re0">$x</span> &lt; <span class="nu0">5</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
<a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="re0">$item</span>-&gt;<span class="me1">ItemAttributes</span>-&gt;<span class="me1">Title</span>.<span class="st0">&quot;<br />
&quot;</span>;<br />
<a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&quot;Link: http://www.amazon.com/exec/obidos/asin/&quot;</span> . <span class="re0">$item</span>-&gt;<span class="me1">ASIN</span> . <span class="st0">&quot;/ref=nosim/&quot;</span> .<span class="re0">$amazontag</span>.<span class="st0">&quot;<br />
&quot;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="br0">&#125;</span><br />
<span class="br0">&#125;</span><br />
<a href="http://www.php.net/unset"><span class="kw3">unset</span></a><span class="br0">&#40;</span><span class="re0">$xml</span><span class="br0">&#41;</span>;<br />
&nbsp;</div>
<p>Below is a partial structure of the XML format. I&#8217;m sure I missed something, so you might want to crack open the XML files yourself to be sure. Hope this helps!!!</p>
<pre>
ASIN
DetailPageURL
SalesRank
SmallImage
	URL
	Height
	Width
MediumImage
	URL
	Height
	Width
LargeImage
	URL
	Height
	Width
ImageSets
	MerchantId
	ImageSet
		attributes
			Category
		SwatchImage
			URL
			Height
			Width
		SmallImage
			URL
			Height
			Width
		ThumbnailImage
			URL
			Height
			Width
		TinyImage
			URL
			Height
			Width
		MediumImage
			URL
			Height
			Width
		LargeImage
			URL
			Height
			Width
ItemAttributes
	Feature
	IsAutographed
	ItemDimensions
	Label
	ListPrice
		Amount
		CurrencyCode
		FormattedPrice
	Manufacturer
	PackageDimensions
	PackageQuantity
	ProductGroup
	ProductTypeName
	Publisher
	SpecialFeatures
	Studio
	Title
OfferSummary
	LowestNewPrice
		Amount
		CurrencyCode
		FormattedPrice
	LowestUsedPrice
		Amount
		CurrencyCode
		FormattedPrice
	TotalNew
	TotalUsed
	TotalCollectible
	TotalRefurbished
Offers
	TotalOffers
	TotalOfferPages
CustomerReviews
	AverageRating
	TotalReviews
	TotalReviewPages
	Review
		ASIN
		Rating
		HelpfulVotes
		CustomerId
		Reviewer
			CustomerId
			Name
		TotalVotes
		Date
		Summary
		Content
EditorialReviews
	EditorialReview
		Source
		Content
SimilarProducts
	SimilarProduct
		ASIN
		Title
Accessories
	Accessory
		ASIN
		Title
BrowseNodes
	BrowseNode
		BrowseNodeId
		Name
		Ancestors
</pre>
<h4>Incoming search terms:</h4><ul><li>amazon searchindex</li><li>amazon catalog api</li><li>amazon catalog web service</li><li>amazon searchindex blended</li><li>catalog search amazon example delphi</li><li>amazon catalog</li><li>amazon api search in multible categories</li><li>amazon catalogue api</li><li>amazon catalog in xml</li><li>search amazon catalog</li></ul><div style='clear:both'></div>

<p>Related posts:<ol><li><a href='http://www.money-code.com/2009/09/finding-browsenodes-for-amazon-api-search-aws/' rel='bookmark' title='Finding BrowseNodes for Amazon API search (AWS)'>Finding BrowseNodes for Amazon API search (AWS)</a></li>
<li><a href='http://www.money-code.com/2007/09/simple-script-for-connecting-to-commission-junctions-product-web-service-and-populating-a-local-database/' rel='bookmark' title='Simple script for connecting to Commission Junction&#8217;s Product Web Service and populating a local database'>Simple script for connecting to Commission Junction&#8217;s Product Web Service and populating a local database</a></li>
<li><a href='http://www.money-code.com/2009/05/amazon-associates-web-service-changes/' rel='bookmark' title='Amazon Associates Web Service Changes'>Amazon Associates Web Service Changes</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.money-code.com/2008/01/how-to-search-amazons-catalog-with-amazons-associate-web-service/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CJ API/WebService version 2</title>
		<link>http://www.money-code.com/2008/01/cj-apiwebservice-version-2/</link>
		<comments>http://www.money-code.com/2008/01/cj-apiwebservice-version-2/#comments</comments>
		<pubDate>Thu, 10 Jan 2008 17:04:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Affiliate Marketing]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[cj]]></category>
		<category><![CDATA[soap]]></category>
		<category><![CDATA[web service]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[<p>There was a comment a couple of days ago about CJ WebService Version 2. I did get this to work. I found some good code another programmer put together that access the v2 WSDL. Basically, this is my API test script, so you need to manually add your keywords and advertiser ID in the code, but it's a proof of concept. I think I've abandoned the CJ API. I personally think it's not that consistent. I often get 'internal server error' in the response XML. I think it might be a riskier move to go version 2 for real time calls.. just my two cents. </p>

<p>This version needs PHP5 with SOAP services built into PHP (--enable-soap). Also it's using try/catch for handling SOAP exception and it's only available in PHP5.</p>

<p>As I mentioned above, I'm pretty much ditching CJ web services all together. I still use eBay's API, but CJ's seems a little off for me. I'm doing initial tests with CJ Data Feeds now, and this really appears to be the direction I need to go.</p>


Related posts:<ol><li><a href='http://www.money-code.com/2007/10/cj-web-service-issues-unable-to-access-wsdl/' rel='bookmark' title='CJ web service issues &#8211; unable to access WSDL'>CJ web service issues &#8211; unable to access WSDL</a></li>
<li><a href='http://www.money-code.com/2007/09/simple-script-for-connecting-to-commission-junctions-product-web-service-and-populating-a-local-database/' rel='bookmark' title='Simple script for connecting to Commission Junction&#8217;s Product Web Service and populating a local database'>Simple script for connecting to Commission Junction&#8217;s Product Web Service and populating a local database</a></li>
<li><a href='http://www.money-code.com/2007/10/cj-web-service-issues-unable-to-access-wsdl-update/' rel='bookmark' title='CJ web service issues &#8211; unable to access WSDL (UPDATE)'>CJ web service issues &#8211; unable to access WSDL (UPDATE)</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.money-code.com%2F2008%2F01%2Fcj-apiwebservice-version-2%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2008%2F01%2Fcj-apiwebservice-version-2%2F&amp;source=hanjicode&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>There was a comment a couple of days ago about CJ WebService Version 2. I did get this to work. I found some good code another programmer put together that access the v2 WSDL. Basically, this is my API test script, so you need to manually add your keywords and advertiser ID in the code, but it&#8217;s a proof of concept. I think I&#8217;ve abandoned the CJ API. I personally think it&#8217;s not that consistent. I often get &#8216;internal server error&#8217; in the response XML. I think it might be a riskier move to go version 2 for real time calls.. just my two cents. </p>
<p>This version needs PHP5 with SOAP services built into PHP (&#8211;enable-soap). Also it&#8217;s using try/catch for handling SOAP exception and it&#8217;s only available in PHP5.</p>
<p>As I mentioned above, I&#8217;m pretty much ditching CJ web services all together. I still use eBay&#8217;s API, but CJ&#8217;s seems a little off for me. I&#8217;m doing initial tests with CJ Data Feeds now, and this really appears to be the direction I need to go.</p>
<div class="dean_ch" style="white-space: wrap;">
<span class="kw2">&lt;?php</span><br />
try <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$ini</span> &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; = <a href="http://www.php.net/ini_set"><span class="kw3">ini_set</span></a><span class="br0">&#40;</span><span class="st0">&quot;soap.wsdl_cache_enabled&quot;</span>,<span class="st0">&quot;0&quot;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$client</span> &nbsp; &nbsp; &nbsp; &nbsp; = <span class="kw2">new</span> SoapClient<span class="br0">&#40;</span><span class="st0">&#8216;productSearchServiceV2.wsdl&#8217;</span>, <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="st0">&#8216;trace&#8217;</span>=&gt; <span class="kw2">true</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$results</span> &nbsp; &nbsp; &nbsp; &nbsp;= <span class="re0">$client</span>-&gt;<span class="me1">search</span><span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$developerKey</span> &nbsp; = <span class="st0">&#8216;yourlongdevkey&#8217;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$websiteId</span> &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&#8217;0000000&#8242;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$advertiserIds</span> &nbsp;= <span class="st0">&#8217;0000001&#8242;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$keywords</span> &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&#8216;your keywords&#8217;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$serviceableArea</span> = <span class="st0">&#8221;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$isbn</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&#8221;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$upc</span> &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&#8221;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$manufacturerName</span> = <span class="st0">&#8221;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$manufacturerSku</span> = <span class="st0">&#8221;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$advertiserSku</span> = <span class="st0">&#8221;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$lowPrice</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&#8221;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$highPrice</span> &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&#8217;50&#8242;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$lowSalePrice</span> &nbsp; = <span class="st0">&#8221;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$highSalePrice</span> &nbsp;= <span class="st0">&#8221;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$currency</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&#8221;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$sortBy</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&#8221;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$SortOrder</span> &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&#8221;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$startAt</span> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; = <span class="nu0">0</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$maxResults</span> &nbsp; &nbsp; = <span class="nu0">100</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// DEBUG</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&quot;&lt;h3&gt;Your search for &#8216;$keywords&#8217; generated $results-&gt;count results&lt;/h3&gt;&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">foreach</span> <span class="br0">&#40;</span><span class="re0">$results</span>-&gt;<span class="me1">products</span> <span class="kw1">as</span> <span class="re0">$product</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><a href="http://www.php.net/strlen"><span class="kw3">strlen</span></a><span class="br0">&#40;</span><a href="http://www.php.net/trim"><span class="kw3">trim</span></a><span class="br0">&#40;</span><span class="re0">$product</span>-&gt;<span class="me1">imageUrl</span><span class="br0">&#41;</span><span class="br0">&#41;</span> &gt; <span class="nu0">0</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$price</span> = <a href="http://www.php.net/sprintf"><span class="kw3">sprintf</span></a><span class="br0">&#40;</span><span class="st0">&#8216;%01.2f&#8217;</span>, <span class="re0">$product</span>-&gt;<span class="me1">price</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&quot;&lt;br&gt;&quot;</span>.<span class="re0">$product</span>-&gt;<span class="me1">advertiserId</span>.<span class="st0">&quot;&lt;br&gt;&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&quot;&lt;br&gt;SKU:&quot;</span>.<span class="re0">$product</span>-&gt;<span class="me1">sku</span>.<span class="st0">&quot;&lt;br&gt;&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&quot;&lt;a href=&#8217;$product-&gt;buyUrl&#8217;&gt;&lt;img src =&#8217;$product-&gt;imageUrl&#8217; height=&#8217;70&#8242; &gt;&lt;p&gt;$product-&gt;name &lt;br/&gt; Offered by $product-&gt;advertiserName($product-&gt;advertiserId) at &lt;b&gt;$price ($product-&gt;currency)&lt;/b&gt;&lt;/p&gt;&lt;/a&gt;&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<span class="br0">&#125;</span> catch <span class="br0">&#40;</span>Exception <span class="re0">$e</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&quot;&lt;div id=&#8217;error&#8217;&gt;&lt;p&gt;There was an error with your request or the service is unavailable.&lt;/p&gt;&lt;/div&gt;&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/print_r"><span class="kw3">print_r</span></a> <span class="br0">&#40;</span><span class="re0">$e</span><span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="kw2">?&gt;</span><br />
&nbsp;</div>
<p>You can download productSearchServiceV2.wsdl <a href="http://www.money-code.com/files/productSearchServiceV2.wsdl" target="_blank" rel="nofollow">here.</a></p>
<p>s</p>
<h4>Incoming search terms:</h4><ul><li>CJ API example</li><li>cj php api</li><li>commission junction api script php</li><li>php cj api</li><li>commission junction php api integration code</li><li>cj php example</li><li>commission junction api php example</li><li>invalid argument supplied for foreach() in cj api</li><li>java lang classcastexception cj web services advertiser</li><li>php code cj web service</li></ul><div style='clear:both'></div>

<p>Related posts:<ol><li><a href='http://www.money-code.com/2007/10/cj-web-service-issues-unable-to-access-wsdl/' rel='bookmark' title='CJ web service issues &#8211; unable to access WSDL'>CJ web service issues &#8211; unable to access WSDL</a></li>
<li><a href='http://www.money-code.com/2007/09/simple-script-for-connecting-to-commission-junctions-product-web-service-and-populating-a-local-database/' rel='bookmark' title='Simple script for connecting to Commission Junction&#8217;s Product Web Service and populating a local database'>Simple script for connecting to Commission Junction&#8217;s Product Web Service and populating a local database</a></li>
<li><a href='http://www.money-code.com/2007/10/cj-web-service-issues-unable-to-access-wsdl-update/' rel='bookmark' title='CJ web service issues &#8211; unable to access WSDL (UPDATE)'>CJ web service issues &#8211; unable to access WSDL (UPDATE)</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.money-code.com/2008/01/cj-apiwebservice-version-2/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>CJ web service issues &#8211; unable to access WSDL (UPDATE)</title>
		<link>http://www.money-code.com/2007/10/cj-web-service-issues-unable-to-access-wsdl-update/</link>
		<comments>http://www.money-code.com/2007/10/cj-web-service-issues-unable-to-access-wsdl-update/#comments</comments>
		<pubDate>Mon, 15 Oct 2007 14:03:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Affiliate Marketing]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[cj]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wsdl]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[<p>Okay, thanks to 'rickybobby' that contacted me through the site. Looks like it's a something sooo simple, I can't believe I didn't even try it. They dropped port 80 access and are restricting connection to port 443 only.

<p><code>
$soapclient = new soapclient("https://api.cj.com/wsdl/productSearchService.wsdl", 'wsdl');
</code>

<p>Changing soapclient instantiation to this will work now. Thanks rickybobby!!!! I've updated the following post to show this change ("<a href="http://www.money-code.com/node/23">Simple script for connecting to Commission Junction's Product Web Service and populating a local database</a>")


Related posts:<ol><li><a href='http://www.money-code.com/2007/10/cj-web-service-issues-unable-to-access-wsdl/' rel='bookmark' title='CJ web service issues &#8211; unable to access WSDL'>CJ web service issues &#8211; unable to access WSDL</a></li>
<li><a href='http://www.money-code.com/2007/09/simple-script-for-connecting-to-commission-junctions-product-web-service-and-populating-a-local-database/' rel='bookmark' title='Simple script for connecting to Commission Junction&#8217;s Product Web Service and populating a local database'>Simple script for connecting to Commission Junction&#8217;s Product Web Service and populating a local database</a></li>
<li><a href='http://www.money-code.com/2009/05/amazon-associates-web-service-changes/' rel='bookmark' title='Amazon Associates Web Service Changes'>Amazon Associates Web Service Changes</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.money-code.com%2F2007%2F10%2Fcj-web-service-issues-unable-to-access-wsdl-update%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2007%2F10%2Fcj-web-service-issues-unable-to-access-wsdl-update%2F&amp;source=hanjicode&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Okay, thanks to &#8216;rickybobby&#8217; that contacted me through the site. Looks like it&#8217;s a something sooo simple, I can&#8217;t believe I didn&#8217;t even try it. They dropped port 80 access and are restricting connection to port 443 only.</p>
<div class="dean_ch" style="white-space: wrap;">
<span class="re0">$soapclient</span> = <span class="kw2">new</span> soapclient<span class="br0">&#40;</span><span class="st0">&quot;https://api.cj.com/wsdl/productSearchService.wsdl&quot;</span>, <span class="st0">&#8216;wsdl&#8217;</span><span class="br0">&#41;</span>;<br />
&nbsp;</div>
<p>Changing soapclient instantiation to this will work now. Thanks rickybobby!!!! I&#8217;ve updated the following post to show this change (&#8220;<a href="http://www.money-code.com/node/23">Simple script for connecting to Commission Junction&#8217;s Product Web Service and populating a local database</a>&#8220;)</p>
<div style='clear:both'></div>

<p>Related posts:<ol><li><a href='http://www.money-code.com/2007/10/cj-web-service-issues-unable-to-access-wsdl/' rel='bookmark' title='CJ web service issues &#8211; unable to access WSDL'>CJ web service issues &#8211; unable to access WSDL</a></li>
<li><a href='http://www.money-code.com/2007/09/simple-script-for-connecting-to-commission-junctions-product-web-service-and-populating-a-local-database/' rel='bookmark' title='Simple script for connecting to Commission Junction&#8217;s Product Web Service and populating a local database'>Simple script for connecting to Commission Junction&#8217;s Product Web Service and populating a local database</a></li>
<li><a href='http://www.money-code.com/2009/05/amazon-associates-web-service-changes/' rel='bookmark' title='Amazon Associates Web Service Changes'>Amazon Associates Web Service Changes</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.money-code.com/2007/10/cj-web-service-issues-unable-to-access-wsdl-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
