<?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; Programming</title>
	<atom:link href="http://www.money-code.com/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.money-code.com</link>
	<description>Coding For Online Success</description>
	<lastBuildDate>Fri, 12 Feb 2010 18:27:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<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='Permanent Link: Amazon Product API: SignatureDoesNotMatch error response'>Amazon Product API: SignatureDoesNotMatch error response</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='Permanent Link: 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='Permanent Link: 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"><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" height="61" width="51" /></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">&#8217;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>


<p>Related posts:<ol><li><a href='http://www.money-code.com/2009/08/amazon-product-api-signaturedoesnotmatch-error-response/' rel='bookmark' title='Permanent Link: Amazon Product API: SignatureDoesNotMatch error response'>Amazon Product API: SignatureDoesNotMatch error response</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='Permanent Link: 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='Permanent Link: 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='Permanent Link: 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='Permanent Link: 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='Permanent Link: 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"><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" height="61" width="51" /></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 &#8217;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 &#8217;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>


<p>Related posts:<ol><li><a href='http://www.money-code.com/2009/08/amazon-product-api-signaturedoesnotmatch-error-response/' rel='bookmark' title='Permanent Link: 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='Permanent Link: 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='Permanent Link: 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>Simple EPN Keyword Tracker for PPC/Organic Searches</title>
		<link>http://www.money-code.com/2009/06/simple-epn-keyword-tracker-for-ppcorganic-searches/</link>
		<comments>http://www.money-code.com/2009/06/simple-epn-keyword-tracker-for-ppcorganic-searches/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 18:12:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[EPN]]></category>
		<category><![CDATA[PPC]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[keyword]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.money-code.com/?p=298</guid>
		<description><![CDATA[I&#8217;ve discussed in the past on how to capture keywords for EPN store front sites. Basically, if you&#8217;re driving traffic with PPC to your store fronts, or even if you&#8217;re promoting them with SEO, you&#8217;ll want to know what keywords are actually converting them.
To do this, you need to capture the keyword in your site [...]


Related posts:<ol><li><a href='http://www.money-code.com/2007/11/tracking-converting-keywords-from-your-ppc-campaigns/' rel='bookmark' title='Permanent Link: Tracking converting keywords from your PPC campaigns'>Tracking converting keywords from your PPC campaigns</a></li>
<li><a href='http://www.money-code.com/2007/12/how-to-use-ppc-with-your-ebay-affiliate-store-fronts/' rel='bookmark' title='Permanent Link: How to use PPC with your eBay Affiliate store fronts'>How to use PPC with your eBay Affiliate store fronts</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='Permanent Link: 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>
</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%2Fsimple-epn-keyword-tracker-for-ppcorganic-searches%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2009%2F06%2Fsimple-epn-keyword-tracker-for-ppcorganic-searches%2F" height="61" width="51" /></a></div><p><a rel="attachment wp-att-301" href="http://www.money-code.com/2009/06/simple-epn-keyword-tracker-for-ppcorganic-searches/ebay-partner-network/"><img class="alignleft size-full wp-image-301" title="ebay-partner-network" src="http://www.money-code.com/wp-content/uploads/2009/06/ebay-partner-network.jpg" alt="ebay-partner-network" width="150" height="150" /></a>I&#8217;ve discussed in the past on how to capture keywords for EPN store front sites. Basically, if you&#8217;re driving traffic with PPC to your store fronts, or even if you&#8217;re promoting them with SEO, you&#8217;ll want to know what keywords are actually converting them.</p>
<p>To do this, you need to capture the keyword in your site and then pass it as a customid field to eBay. From there you&#8217;ll see the keyword in your transaction reports. I&#8217;ve worked on my function(s) for this, I still want to tweak them further, but I&#8217;ll provide them here so you can play with them in your own application. I want to first explain the general idea of how it retains &#8217;state&#8217; throughout my site though. If you&#8217;re the visitor and clicked on one of my PPC ads (either Yahoo, MSN or Adwords), the referring URL passes some useful information to my site. My function looks for particular information and then determines if it can grab a keyword that was passed from the ad. Each program passes information differently. Once a keyword has been determined, my application then appends that variable (kw) to all links within the site. That way the user can visit multiple areas of my site before going to eBay, and my keyword will follow him.</p>
<p>I&#8217;ve considered sticking this in a session or cookie object, but for ease, I left it as a GET or POST variable depending on the situation. I know this part has confused others in the past.</p>
<p>I&#8217;ll try to break down the functions below and describe them as best as possible. Please feel free to comment or email me if something doesn&#8217;t make sense. This is all written in PHP (compatible with versions 4 or 5).</p>
<p>The first function is the primary getKeyword() function. This function has nested functions since I want to take advantage of code reuse:</p>
<div class="dean_ch" style="white-space: wrap;"><span class="kw2">function</span> getKeyword<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/global"><span class="kw3">global</span></a> <span class="re0">$attributes</span>, <span class="re0">$rootpath</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$kw</span>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&#8221;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$attributes</span><span class="br0">&#91;</span><span class="st0">&#8216;kw&#8217;</span><span class="br0">&#93;</span><span class="br0">&#41;</span> &amp;amp;&amp;amp; <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">$attributes</span><span class="br0">&#91;</span><span class="st0">&#8216;kw&#8217;</span><span class="br0">&#93;</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; <span class="re0">$kw</span>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = sanitize<span class="br0">&#40;</span><span class="re0">$attributes</span><span class="br0">&#91;</span><span class="st0">&#8216;kw&#8217;</span><span class="br0">&#93;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// check yahoo</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$attributes</span><span class="br0">&#91;</span><span class="st0">&#8216;OVKEY&#8217;</span><span class="br0">&#93;</span><span class="br0">&#41;</span> &amp;amp;&amp;amp; <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">$attributes</span><span class="br0">&#91;</span><span class="st0">&#8216;OVKEY&#8217;</span><span class="br0">&#93;</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; <span class="re0">$kw</span>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&#8216;ysm&#8217;</span>.sanitize<span class="br0">&#40;</span><span class="re0">$attributes</span><span class="br0">&#91;</span><span class="st0">&#8216;OVKEY&#8217;</span><span class="br0">&#93;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// check handling for msn</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$attributes</span><span class="br0">&#91;</span><span class="st0">&#8216;a&#8217;</span><span class="br0">&#93;</span><span class="br0">&#41;</span> &amp;amp;&amp;amp; <span class="re0">$attributes</span><span class="br0">&#91;</span><span class="st0">&#8216;a&#8217;</span><span class="br0">&#93;</span> == <span class="st0">&#8216;m&#8217;</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/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st0">&#8216;HTTP_REFERER&#8217;</span><span class="br0">&#93;</span><span class="br0">&#41;</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">$kw</span>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = breakQstring<span class="br0">&#40;</span><span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st0">&#8216;HTTP_REFERER&#8217;</span><span class="br0">&#93;</span>, <span class="st0">&#8216;q&#8217;</span>, <span class="st0">&#8216;msn&#8217;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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">$kw</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$kw</span>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&#8216;msnUnknown&#8217;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</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; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$kw</span>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&#8216;msnUnknown&#8217;</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; <span class="co1">// check handling for google</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$attributes</span><span class="br0">&#91;</span><span class="st0">&#8216;a&#8217;</span><span class="br0">&#93;</span><span class="br0">&#41;</span> &amp;amp;&amp;amp; <span class="re0">$attributes</span><span class="br0">&#91;</span><span class="st0">&#8216;a&#8217;</span><span class="br0">&#93;</span> == <span class="st0">&#8216;g&#8217;</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/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st0">&#8216;HTTP_REFERER&#8217;</span><span class="br0">&#93;</span><span class="br0">&#41;</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">$kw</span>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = breakQstring<span class="br0">&#40;</span><span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st0">&#8216;HTTP_REFERER&#8217;</span><span class="br0">&#93;</span>, <span class="st0">&#8216;q&#8217;</span>, <span class="st0">&#8216;goo&#8217;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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">$kw</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$kw</span>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&#8216;gooUnknown&#8217;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</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; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$kw</span>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&#8216;gooUnknown&#8217;</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; <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">$kw</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// now ad passed, check for organic</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$kw</span>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = getKeywordOrganic<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$kw</span>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <a href="http://www.php.net/eregi_replace"><span class="kw3">eregi_replace</span></a><span class="br0">&#40;</span><span class="st0">&quot;([^a-z0-9]+)&quot;</span>,<span class="st0">&#8221;</span>,<span class="re0">$kw</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <a href="http://www.php.net/urlencode"><span class="kw3">urlencode</span></a><span class="br0">&#40;</span><span class="re0">$kw</span><span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span></div>
<p>When I create ads at various PPC networks, I add the following to the URL www.domain.com/a=y. This would pass a=y which would tell my app that the ad is Yahoo.  Once it&#8217;s know where it came from it needs to break the querystring and get down to the variable that contains the keyword. That is what the breakQstring() function is about. It requires the referrer, the variable that contains the keyword, and the label for add source. If no keyword is found (because no &#8216;a&#8217; variable is passed from a ad), it will then check if this is a organic search result with getKeywordOrganic().</p>
<div class="dean_ch" style="white-space: wrap;"><span class="kw2">function</span> getKeywordOrganic<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/global"><span class="kw3">global</span></a> <span class="re0">$rootpath</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$retVal</span>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&#8221;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st0">&#8216;HTTP_REFERER&#8217;</span><span class="br0">&#93;</span><span class="br0">&#41;</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/eregi"><span class="kw3">eregi</span></a><span class="br0">&#40;</span><span class="st0">&#8216;google.com&#8217;</span>,<span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st0">&#8216;HTTP_REFERER&#8217;</span><span class="br0">&#93;</span><span class="br0">&#41;</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">$retVal</span>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; = breakQstring<span class="br0">&#40;</span><span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st0">&#8216;HTTP_REFERER&#8217;</span><span class="br0">&#93;</span>, <span class="st0">&#8216;q&#8217;</span>, <span class="st0">&#8216;orgGoo&#8217;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// end google check</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="kw1">else</span> <span class="kw1">if</span><span class="br0">&#40;</span><a href="http://www.php.net/eregi"><span class="kw3">eregi</span></a><span class="br0">&#40;</span><span class="st0">&#8217;search.yahoo.com&#8217;</span>,<span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st0">&#8216;HTTP_REFERER&#8217;</span><span class="br0">&#93;</span><span class="br0">&#41;</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">$retVal</span>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; = breakQstring<span class="br0">&#40;</span><span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st0">&#8216;HTTP_REFERER&#8217;</span><span class="br0">&#93;</span>, <span class="st0">&#8216;p&#8217;</span>, <span class="st0">&#8216;orgYah&#8217;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// end yahoo check</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="kw1">else</span> <span class="kw1">if</span><span class="br0">&#40;</span><a href="http://www.php.net/eregi"><span class="kw3">eregi</span></a><span class="br0">&#40;</span><span class="st0">&#8216;bing.com&#8217;</span>,<span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st0">&#8216;HTTP_REFERER&#8217;</span><span class="br0">&#93;</span><span class="br0">&#41;</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">$retVal</span>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; = breakQstring<span class="br0">&#40;</span><span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st0">&#8216;HTTP_REFERER&#8217;</span><span class="br0">&#93;</span>, <span class="st0">&#8216;q&#8217;</span>, <span class="st0">&#8216;orgBing&#8217;</span><span class="br0">&#41;</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; <span class="kw1">return</span> <span class="re0">$retVal</span>;<br />
<span class="br0">&#125;</span></div>
<p>getKeywordOrganic looks at the referrer again and looks for the appropriate variable where the keyword is normally found. This function will handle Google, Yahoo and Bing.</p>
<div class="dean_ch" style="white-space: wrap;"><span class="kw2">function</span> breakQstring<span class="br0">&#40;</span><span class="re0">$inRef</span>, <span class="re0">$inVarCatch</span>, <span class="re0">$inType</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/global"><span class="kw3">global</span></a> <span class="re0">$rootpath</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$kw</span>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&#8221;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$xstring</span>&nbsp; &nbsp; &nbsp; &nbsp; = <a href="http://www.php.net/explode"><span class="kw3">explode</span></a><span class="br0">&#40;</span><span class="st0">&#8216;?&#8217;</span>,<span class="re0">$inRef</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><a href="http://www.php.net/sizeof"><span class="kw3">sizeof</span></a><span class="br0">&#40;</span><span class="re0">$xstring</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; <span class="kw1">if</span><span class="br0">&#40;</span><a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$xstring</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span><span class="br0">&#41;</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">$varstring</span>&nbsp; &nbsp; &nbsp; = <a href="http://www.php.net/explode"><span class="kw3">explode</span></a><span class="br0">&#40;</span><span class="st0">&#8216;&amp;amp;&#8217;</span>,<span class="re0">$xstring</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><a href="http://www.php.net/sizeof"><span class="kw3">sizeof</span></a><span class="br0">&#40;</span><span class="re0">$varstring</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; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span><span class="br0">&#40;</span><span class="re0">$x</span> = <span class="nu0">0</span>; <span class="re0">$x</span> &lt; <a href="http://www.php.net/sizeof"><span class="kw3">sizeof</span></a><span class="br0">&#40;</span><span class="re0">$varstring</span><span class="br0">&#41;</span>; <span class="re0">$x</span>++<span class="br0">&#41;</span><span class="br0">&#123;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$varstring</span><span class="br0">&#91;</span><span class="re0">$x</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="br0">&#41;</span> &amp;amp;&amp;amp; <span class="re0">$varstring</span><span class="br0">&#91;</span><span class="re0">$x</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> == <span class="re0">$inVarCatch</span><span class="br0">&#41;</span><span class="br0">&#123;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$valstring</span>&nbsp; &nbsp; &nbsp; = <a href="http://www.php.net/explode"><span class="kw3">explode</span></a><span class="br0">&#40;</span><span class="st0">&#8216;=&#8217;</span>,<span class="re0">$varstring</span><span class="br0">&#91;</span><span class="re0">$x</span><span class="br0">&#93;</span><span class="br0">&#41;</span>; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$valstring</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span><span class="br0">&#41;</span> &amp;amp;&amp;amp; <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">$valstring</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$kw</span>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="re0">$inType</span>.sanitize<span class="br0">&#40;</span><span class="re0">$valstring</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">break</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</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">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</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; <span class="co1">// clean up</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$xstring</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#123;</span> &nbsp; &nbsp;<a href="http://www.php.net/unset"><span class="kw3">unset</span></a><span class="br0">&#40;</span><span class="re0">$xstring</span><span class="br0">&#41;</span>;<span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$varstring</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#123;</span>&nbsp; <a href="http://www.php.net/unset"><span class="kw3">unset</span></a><span class="br0">&#40;</span><span class="re0">$varstring</span><span class="br0">&#41;</span>;<span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$valstring</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#123;</span>&nbsp; <a href="http://www.php.net/unset"><span class="kw3">unset</span></a><span class="br0">&#40;</span><span class="re0">$valstring</span><span class="br0">&#41;</span>;<span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="re0">$kw</span>;<br />
<span class="br0">&#125;</span></div>
<p>breakQstring() is designed to disassemble the querystring and filter it down to simple variable value pairs and stop when if finds what it&#8217;s looking for. If there is a value, it will return the keyword to the parent getKeyword(). I simply call this function and set a local $kw variable. I want to note that I&#8217;m using $attributes, you&#8217;ll probably need to use $_REQUEST or $_GET or $_POST depending on your situation.</p>
<p>After you have a local $kw variable, you would then pass that to your rover link and add it to the customid field of that link. You should start seeing keywords, search network and organic information in your transaction reports at EPN.</p>


<p>Related posts:<ol><li><a href='http://www.money-code.com/2007/11/tracking-converting-keywords-from-your-ppc-campaigns/' rel='bookmark' title='Permanent Link: Tracking converting keywords from your PPC campaigns'>Tracking converting keywords from your PPC campaigns</a></li>
<li><a href='http://www.money-code.com/2007/12/how-to-use-ppc-with-your-ebay-affiliate-store-fronts/' rel='bookmark' title='Permanent Link: How to use PPC with your eBay Affiliate store fronts'>How to use PPC with your eBay Affiliate store fronts</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='Permanent Link: 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>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.money-code.com/2009/06/simple-epn-keyword-tracker-for-ppcorganic-searches/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>GeoIP Scripts PHP and JavaScript</title>
		<link>http://www.money-code.com/2009/06/geoip-scripts-php-and-javascript/</link>
		<comments>http://www.money-code.com/2009/06/geoip-scripts-php-and-javascript/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 00:02:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Affiliate Marketing]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[geoip]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.money-code.com/?p=270</guid>
		<description><![CDATA[Last week I was reading Danger Brown&#8217;s &#8220;Easy geo/ip script to be sneaky with&#8220;, and oddly enough just days before that I was working on a server side solution to do the same thing. His example is using maxmind&#8217;s geoip.js script to determine where your referring IP address is coming from. Here is the script [...]


Related posts:<ol><li><a href='http://www.money-code.com/2009/07/monitor-your-sites-watch-your-logs/' rel='bookmark' title='Permanent Link: Monitor your sites &#8211; Watch your logs'>Monitor your sites &#8211; Watch your logs</a></li>
<li><a href='http://www.money-code.com/2007/11/google-adsense-how-to-randomize-theme/' rel='bookmark' title='Permanent Link: Google Adsense &#8211; How to randomize theme'>Google Adsense &#8211; How to randomize theme</a></li>
<li><a href='http://www.money-code.com/2009/07/php-for-affiliate-marketers/' rel='bookmark' title='Permanent Link: PHP for Affiliate Marketers'>PHP for Affiliate Marketers</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%2Fgeoip-scripts-php-and-javascript%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2009%2F06%2Fgeoip-scripts-php-and-javascript%2F" height="61" width="51" /></a></div><p>Last week I was reading Danger Brown&#8217;s &#8220;<a href="http://dangerbrown.com/easy-geoip-script-to-be-sneaky-with/" target="_blank">Easy geo/ip script to be sneaky with</a>&#8220;, and oddly enough just days before that I was working on a server side solution to do the same thing. His example is using maxmind&#8217;s geoip.js script to determine where your referring IP address is coming from. Here is the script to do this client side using javascript.</p>
<div class="dean_ch" style="white-space: wrap;"><span class="kw2">&lt;script language</span>=<span class="st0">&quot;JavaScript&quot;</span> src=<span class="st0">&quot;http://j.maxmind.com/app/geoip.js&quot;</span>&gt;&lt;/script&gt;<br />
<span class="kw2">&lt;script language</span>=<span class="st0">&quot;JavaScript&quot;</span>&gt;document.write<span class="br0">&#40;</span>geoip_city<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;&lt;/script&gt;<br />
<span class="kw2">&lt;script language</span>=<span class="st0">&quot;JavaScript&quot;</span>&gt;document.write<span class="br0">&#40;</span>geoip_region<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;&lt;/script&gt;</div>
<p><a href="http://www.maxmind.com/app/ip-locate" target="_blank">MaxMind</a> creates IP geolocation services and offers this server for free or at a cost, depending on your needs. I wanted to be able to add some conditionals in my example, and have this be available for bots and browsers that do not support javascript. The solution is to grab the geoip information serverside, and then generate the output in HTML using PHP.</p>
<p>To do this you will need to make sure that your version has the pecl-geoip extension available. I&#8217;m using <a href="http://pecl.php.net/geoip" target="_blank">dev-php5/pecl-geoip</a>. After this extension is built and is available to your PHP installation, you can simple call this geoip_record_by_name() function and pass a valid IP address.</p>
<p>For example, this is looking up a Google IP:</p>
<div class="dean_ch" style="white-space: wrap;"><span class="re0">$record</span> = geoip_record_by_name<span class="br0">&#40;</span><span class="st0">&#8216;74.125.67.100&#8242;</span><span class="br0">&#41;</span>;<br />
<a href="http://www.php.net/var_dump"><span class="kw3">var_dump</span></a><span class="br0">&#40;</span><span class="re0">$record</span><span class="br0">&#41;</span>;</div>
<p>$record is a array that contains some useful information about that IP:</p>
<div class="dean_ch" style="white-space: wrap;"><a href="http://www.php.net/array"><span class="kw3">array</span></a><br />
<span class="st0">&#8216;country_code&#8217;</span> =&gt; string <span class="st0">&#8216;US&#8217;</span> <span class="br0">&#40;</span>length=<span class="nu0">2</span><span class="br0">&#41;</span><br />
<span class="st0">&#8216;region&#8217;</span> =&gt; string <span class="st0">&#8216;CA&#8217;</span> <span class="br0">&#40;</span>length=<span class="nu0">2</span><span class="br0">&#41;</span><br />
<span class="st0">&#8216;city&#8217;</span> =&gt; string <span class="st0">&#8216;Mountain View&#8217;</span> <span class="br0">&#40;</span>length=<span class="nu0">13</span><span class="br0">&#41;</span><br />
<span class="st0">&#8216;postal_code&#8217;</span> =&gt; string <span class="st0">&#8216;94043&#8242;</span> <span class="br0">&#40;</span>length=<span class="nu0">5</span><span class="br0">&#41;</span><br />
<span class="st0">&#8216;latitude&#8217;</span> =&gt; float <span class="nu0">37.4192008972</span><br />
<span class="st0">&#8216;longitude&#8217;</span> =&gt; float <span class="nu0">-122.057403564</span><br />
<span class="st0">&#8216;dma_code&#8217;</span> =&gt; int <span class="nu0">807</span><br />
<span class="st0">&#8216;area_code&#8217;</span> =&gt; int <span class="nu0">650</span></div>
<p>I had some problems with a missing GeoLiteCity.dat file that was missing. LiteCity is free, and any additional dats will cost money. Luckily, MaxMind had a download here: <a href="http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz" target="_blank">http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz</a></p>
<p>If you need function definitions, you can view them here. I was glad that I found this forum entry, pecl documentation and examples usually suck pretty bad:<br />
<a href="http://forum.maxmind.com/viewtopic.php?p=44" target="_blank">http://forum.maxmind.com/viewtopic.php?p=44</a></p>


<p>Related posts:<ol><li><a href='http://www.money-code.com/2009/07/monitor-your-sites-watch-your-logs/' rel='bookmark' title='Permanent Link: Monitor your sites &#8211; Watch your logs'>Monitor your sites &#8211; Watch your logs</a></li>
<li><a href='http://www.money-code.com/2007/11/google-adsense-how-to-randomize-theme/' rel='bookmark' title='Permanent Link: Google Adsense &#8211; How to randomize theme'>Google Adsense &#8211; How to randomize theme</a></li>
<li><a href='http://www.money-code.com/2009/07/php-for-affiliate-marketers/' rel='bookmark' title='Permanent Link: PHP for Affiliate Marketers'>PHP for Affiliate Marketers</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.money-code.com/2009/06/geoip-scripts-php-and-javascript/feed/</wfw:commentRss>
		<slash:comments>1</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='Permanent Link: 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='Permanent Link: 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='Permanent Link: 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"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2009%2F05%2Famazon-associates-web-service-changes%2F" height="61" width="51" /></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>


<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='Permanent Link: 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='Permanent Link: 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='Permanent Link: 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>PopShop redirect all links to your domain</title>
		<link>http://www.money-code.com/2009/05/popshop-redirect-all-links-to-your-domain/</link>
		<comments>http://www.money-code.com/2009/05/popshop-redirect-all-links-to-your-domain/#comments</comments>
		<pubDate>Mon, 04 May 2009 02:14:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Affiliate Marketing]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[link redirection]]></category>
		<category><![CDATA[popshops]]></category>
		<category><![CDATA[redirect]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[<p>I like to have all external affiliate links point back to my domain. I don't want to advertise lots of external links to search bots so I do some basic link cloaking back to my domain and redirect. I wanted the same effect with my PopShop products. Luckily, PopShops provides this as a feature for Enterprise users.</p>

<p>A little background, <a href="http://www.popshops.com" target="_blank">PopShops</a> is a great tool to quickly add products across various affiliate networks (CJ, ShareASale, GAN, etc). There is NOT easier way to add products to your site than PopShops, and I'm a huge fan!</p>

<p>To add link redirection you will need to do two things.</p>

<p>#1 Add a piece of code on all pages that have PopShop products.</p>

<p><code>
<?php
ob_start(); 
if (isset($_REQUEST['psps_product'])) 
	header('Location:http://r.popshops.com/'.$_REQUEST['psps_product']); 
ob_end_flush(); 
?>
</code></p>


Related posts:<ol><li><a href='http://www.money-code.com/2008/10/dynamic-xmlrss-feed-using-popshops/' rel='bookmark' title='Permanent Link: Dynamic XML/RSS Feed using PopShops'>Dynamic XML/RSS Feed using PopShops</a></li>
<li><a href='http://www.money-code.com/2009/05/picking-and-purchasing-domain-names/' rel='bookmark' title='Permanent Link: Picking and purchasing domain names'>Picking and purchasing domain names</a></li>
<li><a href='http://www.money-code.com/2008/02/popshops/' rel='bookmark' title='Permanent Link: popshops'>popshops</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%2Fpopshop-redirect-all-links-to-your-domain%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2009%2F05%2Fpopshop-redirect-all-links-to-your-domain%2F" height="61" width="51" /></a></div><p>I like to have all external affiliate links point back to my domain. I don&#8217;t want to advertise lots of external links to search bots so I do some basic link cloaking back to my domain and redirect. I wanted the same effect with my PopShop products. Luckily, PopShops provides this as a feature for Enterprise users.</p>
<p>A little background, <a href="http://www.popshops.com" target="_blank">PopShops</a> is a great tool to quickly add products across various affiliate networks (CJ, ShareASale, GAN, etc). There is NOT easier way to add products to your site than PopShops, and I&#8217;m a huge fan!</p>
<p>To add link redirection you will need to do two things.</p>
<p>#1 Add a piece of code on all pages that have PopShop products.</p>
<div class="dean_ch" style="white-space: wrap;">
<span class="kw2">&lt;?php</span><br />
<a href="http://www.php.net/ob_start"><span class="kw3">ob_start</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span>; <br />
<span class="kw1">if</span> <span class="br0">&#40;</span><a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$_REQUEST</span><span class="br0">&#91;</span><span class="st0">&#8216;psps_product&#8217;</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/header"><span class="kw3">header</span></a><span class="br0">&#40;</span><span class="st0">&#8216;Location:http://r.popshops.com/&#8217;</span>.<span class="re0">$_REQUEST</span><span class="br0">&#91;</span><span class="st0">&#8216;psps_product&#8217;</span><span class="br0">&#93;</span><span class="br0">&#41;</span>; <br />
<a href="http://www.php.net/ob_end_flush"><span class="kw3">ob_end_flush</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span>; <br />
<span class="kw2">?&gt;</span><br />
&nbsp;</div>
<p>#2 Adjust your PopShop shop (via PopShop&#8217;s interface) to allow Link Redirection<br />
	- Open your shop<br />
	- Click Preferences<br />
	- Click the Link Redirection tab<br />
	- Check &#8216;Have all product redirects point to your own domain.&#8217;</p>
<p>What this will do is convert links to look like this:</p>
<p>http://www.yourdomain.com/?psps_product=sp/130854/2970123463/my-product-item</p>
<p>When a user clicks the link, they will be redirected to the same page where it was created, but the hunk of code will detect &#8216;psps_product&#8217; and redirect the user to the r.popshops.com domain and on to the designated affiliate.</p>


<p>Related posts:<ol><li><a href='http://www.money-code.com/2008/10/dynamic-xmlrss-feed-using-popshops/' rel='bookmark' title='Permanent Link: Dynamic XML/RSS Feed using PopShops'>Dynamic XML/RSS Feed using PopShops</a></li>
<li><a href='http://www.money-code.com/2009/05/picking-and-purchasing-domain-names/' rel='bookmark' title='Permanent Link: Picking and purchasing domain names'>Picking and purchasing domain names</a></li>
<li><a href='http://www.money-code.com/2008/02/popshops/' rel='bookmark' title='Permanent Link: popshops'>popshops</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.money-code.com/2009/05/popshop-redirect-all-links-to-your-domain/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP &#124; Architect Magazine</title>
		<link>http://www.money-code.com/2008/11/php-architect-magazine/</link>
		<comments>http://www.money-code.com/2008/11/php-architect-magazine/#comments</comments>
		<pubDate>Fri, 14 Nov 2008 17:09:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[<p><a href="http://www.amazon.com/gp/product/B0000A432X?ie=UTF8&#038;tag=moneycode-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=B0000A432X"><img border="0" src="http://www.money-code.com/files/phpArch.jpg" style="float: left; margin-right: 10px;"></a>I've been a PHP developer for quite a few years now. I've accumulated a fairly large library of PHP and MySQL related books and have read countless how-tos and development articles on the web. As a PHP developer you really need the ability to identify and overcome daily programming challenges. This is done via web searches, forum posts and referring to books on occasion. Now-a-days I have a very large set of code to pull examples from, which can be very helpful, but it's important to always push yourself and find a better or more efficient way to perform the same task. If you do any coding at all, you'll surely know what I'm talking about.</p>


Related posts:<ol><li><a href='http://www.money-code.com/2009/07/php-for-affiliate-marketers/' rel='bookmark' title='Permanent Link: PHP for Affiliate Marketers'>PHP for Affiliate Marketers</a></li>
<li><a href='http://www.money-code.com/2009/06/geoip-scripts-php-and-javascript/' rel='bookmark' title='Permanent Link: GeoIP Scripts PHP and JavaScript'>GeoIP Scripts PHP and JavaScript</a></li>
<li><a href='http://www.money-code.com/2007/09/build-a-niche-store-bans-unsatisfied-programmer/' rel='bookmark' title='Permanent Link: Build A Niche Store (BANS) &#8211; Unsatisfied Programmer'>Build A Niche Store (BANS) &#8211; Unsatisfied Programmer</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%2F11%2Fphp-architect-magazine%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2008%2F11%2Fphp-architect-magazine%2F" height="61" width="51" /></a></div><p><a href="http://www.amazon.com/gp/product/B0000A432X?ie=UTF8&#038;tag=moneycode-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=B0000A432X"><img border="0" src="http://www.money-code.com/files/phpArch.jpg" style="float: left; margin-right: 10px;"></a>I&#8217;ve been a PHP developer for quite a few years now. I&#8217;ve accumulated a fairly large library of PHP and MySQL related books and have read countless how-tos and development articles on the web. As a PHP developer you really need the ability to identify and overcome daily programming challenges. This is done via web searches, forum posts and referring to books on occasion. Now-a-days I have a very large set of code to pull examples from, which can be very helpful, but it&#8217;s important to always push yourself and find a better or more efficient way to perform the same task. If you do any coding at all, you&#8217;ll surely know what I&#8217;m talking about.</p>
<p>To me, this always comes down to inspiration. Seeing good examples or interesting new methodologies promotes creative and innovative coding. The last few years, I started feeling that books and web searches weren&#8217;t really cutting it for me. It almost seemed like the examples were either &#8220;old school&#8221; or crappy programming. I primarily define crappy programming by insecure and/or inefficient coding practices (see: BANS).</p>
<p>A couple of years ago, I came across a fantastic magazine called PHP | Architect. This magazine is the best magazine focusing PHP development and is truly a good read. I find myself getting inspired with every issue. The biggest reasons why I like this magazine, is that fact that they talk about new things going on in the PHP world. As an affiliate marketer AND a PHP programmer, I feel that these things could potentially give you a slight edge with the competition. Developing ideas that have not reached the affiliate world yet. The other huge plus of the magazine is that they focus on excellent coding practices and always have a eye on security. I do appreciate that.</p>
<p>If any of you are starting out with PHP programming, I strongly recommend you pick this magazine up. If you guys are seasoned programmers.. then again, I would still recommend this magazine. To me, this beats any books currently being published, and I&#8217;ve yet to see a good PHP resource on the web that can match this.</p>
<p>Currently, buying at <a href="http://www.amazon.com/gp/product/B0000A432X?ie=UTF8&#038;tag=moneycode-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=B0000A432X"><u>Amazon</u></a> will save you a ton of dough. It&#8217;s only $29.99 for a 12 month subscription. WTF? That&#8217;s a awesome deal!</p>


<p>Related posts:<ol><li><a href='http://www.money-code.com/2009/07/php-for-affiliate-marketers/' rel='bookmark' title='Permanent Link: PHP for Affiliate Marketers'>PHP for Affiliate Marketers</a></li>
<li><a href='http://www.money-code.com/2009/06/geoip-scripts-php-and-javascript/' rel='bookmark' title='Permanent Link: GeoIP Scripts PHP and JavaScript'>GeoIP Scripts PHP and JavaScript</a></li>
<li><a href='http://www.money-code.com/2007/09/build-a-niche-store-bans-unsatisfied-programmer/' rel='bookmark' title='Permanent Link: Build A Niche Store (BANS) &#8211; Unsatisfied Programmer'>Build A Niche Store (BANS) &#8211; Unsatisfied Programmer</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.money-code.com/2008/11/php-architect-magazine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>EPN EditorKit Transition</title>
		<link>http://www.money-code.com/2008/04/epn-editorkit-transition/</link>
		<comments>http://www.money-code.com/2008/04/epn-editorkit-transition/#comments</comments>
		<pubDate>Wed, 02 Apr 2008 15:40:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[EPN]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[editor kit]]></category>
		<category><![CDATA[ek]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I've successfully migrated two sites yesterday (both of which were the most challenging sites in regards to eBay configurations). I did run into some weirdness with the EditorKit, so I wanted to show the variables that need to be changed for it work properly (I still haven't seen any earnings at EPN... so properly might not be the best word here).

You'll need to change/add 4 values

<strong>toolid=10004</strong>
<strong>track=yourcampid</strong>
<strong>sid=something</strong> (I wanted to use sid, since trackid and RSS were having issues)
<strong>prvd=9</strong> (this is important, this is what converts things to campid, etc)
 



Related posts:<ol><li><a href='http://www.money-code.com/2008/04/use-live-http-headers-to-verify-your-epn-links-are-working/' rel='bookmark' title='Permanent Link: Use Live HTTP Headers to verify your EPN links are working'>Use Live HTTP Headers to verify your EPN links are working</a></li>
<li><a href='http://www.money-code.com/2009/10/epn-tracking-image/' rel='bookmark' title='Permanent Link: EPN Tracking Image'>EPN Tracking Image</a></li>
<li><a href='http://www.money-code.com/2007/11/tracking-converting-keywords-from-your-ppc-campaigns/' rel='bookmark' title='Permanent Link: Tracking converting keywords from your PPC campaigns'>Tracking converting keywords from your PPC campaigns</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%2F04%2Fepn-editorkit-transition%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2008%2F04%2Fepn-editorkit-transition%2F" height="61" width="51" /></a></div><p>I&#8217;ve successfully migrated two sites yesterday (both of which were the most challenging sites in regards to eBay configurations). I did run into some weirdness with the EditorKit, so I wanted to show the variables that need to be changed for it work properly (I still haven&#8217;t seen any earnings at EPN&#8230; so properly might not be the best word here).</p>
<p>You&#8217;ll need to change/add 4 values</p>
<p><strong>toolid=10004</strong><br />
<strong>track=yourcampid</strong><br />
<strong>sid=something</strong> (I wanted to use sid, since trackid and RSS were having issues)<br />
<strong>prvd=9</strong> (this is important, this is what converts things to campid, etc)</p>
<p>As stated above, EPN hasn&#8217;t shown any earnings for me yet. I definitely think there are issues, I&#8217;ll hold off on my remaining migrations until I actually see earnings reported. Hopefully, this is a tracking delay. So far, tracking is no better than CJ.. and I personally like the CJ quick stat rate better than what I&#8217;m seeing at EPN. Things will get better&#8230; I hope?</p>


<p>Related posts:<ol><li><a href='http://www.money-code.com/2008/04/use-live-http-headers-to-verify-your-epn-links-are-working/' rel='bookmark' title='Permanent Link: Use Live HTTP Headers to verify your EPN links are working'>Use Live HTTP Headers to verify your EPN links are working</a></li>
<li><a href='http://www.money-code.com/2009/10/epn-tracking-image/' rel='bookmark' title='Permanent Link: EPN Tracking Image'>EPN Tracking Image</a></li>
<li><a href='http://www.money-code.com/2007/11/tracking-converting-keywords-from-your-ppc-campaigns/' rel='bookmark' title='Permanent Link: Tracking converting keywords from your PPC campaigns'>Tracking converting keywords from your PPC campaigns</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.money-code.com/2008/04/epn-editorkit-transition/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Build a Niche Store (Parent Site) Hacked?!?!</title>
		<link>http://www.money-code.com/2008/03/build-a-niche-store-parent-site-hacked/</link>
		<comments>http://www.money-code.com/2008/03/build-a-niche-store-parent-site-hacked/#comments</comments>
		<pubDate>Fri, 14 Mar 2008 17:49:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Affiliate Marketing]]></category>
		<category><![CDATA[EPN]]></category>
		<category><![CDATA[bans]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[<p>I remember my first interaction with BANS, and it was horrible, but oddly enough, it started with me visiting their site and was surprised to see that my browser was prompted for downloading the PHP source code? I noticed that DB connection string was exposed, so I quickly notified BANS via digital point forums. They were aware of the problem (as to why they didn't disable the site completely during the outage is surprising). You'd think DB connection strings would be quite useful to hackers.</p>

<p>Fast forward 8 months or so to today, and I was surprised to see that someone stated that the site was hacked on the forums. I had to check it out, since I haven't been to the BANS site in a long time, and sure enough, I was viewing the following screen(s):</p>

<p><table cellpadding="5" cellspacing="0" border="0" align="center">
<tr>
	<td valign="top">
	<a href="http://www.money-code.com/files/bans_hack1.jpg" target="_blank"><img src="http://www.money-code.com/files/bans_hack_th1.jpg" border="0" /></a>
	</td>
	<td valign="top">
	<a href="http://www.money-code.com/files/bans_hack2.jpg" target="_blank"><img src="http://www.money-code.com/files/bans_hack_th2.jpg" border="0" /></a>
	</td>
</tr>
</table></p>



Related posts:<ol><li><a href='http://www.money-code.com/2007/09/build-a-niche-store-security-issues/' rel='bookmark' title='Permanent Link: Build A Niche Store &#8211; Security Issues'>Build A Niche Store &#8211; Security Issues</a></li>
<li><a href='http://www.money-code.com/2007/09/build-a-niche-store-bans-unsatisfied-programmer/' rel='bookmark' title='Permanent Link: Build A Niche Store (BANS) &#8211; Unsatisfied Programmer'>Build A Niche Store (BANS) &#8211; Unsatisfied Programmer</a></li>
<li><a href='http://www.money-code.com/2007/09/build-a-niche-store-bans-security-issues-are-being-addressed-continued/' rel='bookmark' title='Permanent Link: Build A Niche Store (bans) &#8211; Security issues are being addressed (continued)'>Build A Niche Store (bans) &#8211; Security issues are being addressed (continued)</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%2F03%2Fbuild-a-niche-store-parent-site-hacked%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2008%2F03%2Fbuild-a-niche-store-parent-site-hacked%2F" height="61" width="51" /></a></div><p>I remember my first interaction with BANS, and it was horrible, but oddly enough, it started with me visiting their site and was surprised to see that my browser was prompted for downloading the PHP source code? I noticed that DB connection string was exposed, so I quickly notified BANS via digital point forums. They were aware of the problem (as to why they didn&#8217;t disable the site completely during the outage is surprising). You&#8217;d think DB connection strings would be quite useful to hackers.</p>
<p>Fast forward 8 months or so to today, and I was surprised to see that someone stated that the site was hacked on the forums. I had to check it out, since I haven&#8217;t been to the BANS site in a long time, and sure enough, I was viewing the following screen(s):</p>
<table border="0" cellspacing="0" cellpadding="5" align="center">
<tbody>
<tr>
<td valign="top"><a href="http://www.money-code.com/files/bans_hack1.jpg" target="_blank"><img src="http://www.money-code.com/files/bans_hack_th1.jpg" border="0" alt="" /></a></td>
<td valign="top"><a href="http://www.money-code.com/files/bans_hack2.jpg" target="_blank"><img src="http://www.money-code.com/files/bans_hack_th2.jpg" border="0" alt="" /></a></td>
</tr>
</tbody>
</table>
<p><!--break--></p>
<p>Nationwide Internet Banking? Possible phishing site? Either way, bad for BANS. From their buggy release of v3.0 to this? It does look however to possibly be a classic server wide defacement and may not be isolated to buildanichestore.com, since subpages are still operational. Most likely it was default document hack on the web server that is causing this. If that is the case, they might need to consider a new host, since the problem I experienced last summer was a server issue as well. Personally, this is annoying to me, since I know I have personal information most likely stored on that database, and we have to easily assume that that information is compromised as well.</p>
<p>Here is more information about this particular hack:<br />
<a href="http://phishery.internetdefence.net/data/9252/" target="_blank">http://phishery.internetdefence.net/data/9252/</a></p>


<p>Related posts:<ol><li><a href='http://www.money-code.com/2007/09/build-a-niche-store-security-issues/' rel='bookmark' title='Permanent Link: Build A Niche Store &#8211; Security Issues'>Build A Niche Store &#8211; Security Issues</a></li>
<li><a href='http://www.money-code.com/2007/09/build-a-niche-store-bans-unsatisfied-programmer/' rel='bookmark' title='Permanent Link: Build A Niche Store (BANS) &#8211; Unsatisfied Programmer'>Build A Niche Store (BANS) &#8211; Unsatisfied Programmer</a></li>
<li><a href='http://www.money-code.com/2007/09/build-a-niche-store-bans-security-issues-are-being-addressed-continued/' rel='bookmark' title='Permanent Link: Build A Niche Store (bans) &#8211; Security issues are being addressed (continued)'>Build A Niche Store (bans) &#8211; Security issues are being addressed (continued)</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.money-code.com/2008/03/build-a-niche-store-parent-site-hacked/feed/</wfw:commentRss>
		<slash:comments>3</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='Permanent Link: 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='Permanent Link: Amazon Associates Web Service Changes'>Amazon Associates Web Service Changes</a></li>
<li><a href='http://www.money-code.com/2009/08/amazon-product-api-signaturedoesnotmatch-error-response/' rel='bookmark' title='Permanent Link: Amazon Product API: SignatureDoesNotMatch error response'>Amazon Product API: SignatureDoesNotMatch error response</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"><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" height="61" width="51" /></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">&#8217;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">&#8217;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&#8217;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>


<p>Related posts:<ol><li><a href='http://www.money-code.com/2009/09/finding-browsenodes-for-amazon-api-search-aws/' rel='bookmark' title='Permanent Link: 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='Permanent Link: Amazon Associates Web Service Changes'>Amazon Associates Web Service Changes</a></li>
<li><a href='http://www.money-code.com/2009/08/amazon-product-api-signaturedoesnotmatch-error-response/' rel='bookmark' title='Permanent Link: Amazon Product API: SignatureDoesNotMatch error response'>Amazon Product API: SignatureDoesNotMatch error response</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>
	</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! -->