<?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; php</title>
	<atom:link href="http://www.money-code.com/tag/php/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>EPN change to RSS</title>
		<link>http://www.money-code.com/2010/01/epn-change-to-rss/</link>
		<comments>http://www.money-code.com/2010/01/epn-change-to-rss/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 16:58:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[EPN]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[rover]]></category>

		<guid isPermaLink="false">http://www.money-code.com/?p=613</guid>
		<description><![CDATA[So I mentioned earlier that BANS users were experiencing problems at the same time of my issues with dynamic RSS search results. It also appears that some phpBayPro users as well as a few other EPN scripts are experiencing issues. On the EPN board &#8216;casey&#8217; replied with the following statement in a thread where individuals [...]


Related posts:<ol><li><a href='http://www.money-code.com/2010/01/pay-attention-to-your-roll-your-own-epn-sites/' rel='bookmark' title='Permanent Link: Pay Attention to your Roll-Your-Own EPN sites'>Pay Attention to your Roll-Your-Own EPN sites</a></li>
<li><a href='http://www.money-code.com/2007/10/paging-ebay-rss-results/' rel='bookmark' title='Permanent Link: Paging eBay RSS results'>Paging eBay RSS results</a></li>
<li><a href='http://www.money-code.com/2008/04/epn-editorkit-transition/' rel='bookmark' title='Permanent Link: EPN EditorKit Transition'>EPN EditorKit Transition</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%2F2010%2F01%2Fepn-change-to-rss%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2010%2F01%2Fepn-change-to-rss%2F" height="61" width="51" /></a></div><p>So I mentioned earlier that BANS users were experiencing problems at the same time of my issues with dynamic RSS search results. It also appears that some phpBayPro users as well as a few other EPN scripts are experiencing issues. On the EPN board &#8216;casey&#8217; replied with the following statement in a thread where individuals were trying to debug the issue:</p>
<blockquote><p>Hi everyone,</p>
<p>We’d like to thank you for your patience through the recent change made to the RSS Feed links that has impacted some of you, and apologize for the delayed response on the boards as well as the lack of a proactive message to announce this change. There was some miscommunication here on when this change was planned to roll out. Essentially we updated the links in the RSS Feeds to reflect the new link generator structure which we implemented a while back. This new link structure includes added parameters that we plan to use for some optimization initiatives to further enhance our tools and most importantly help generate higher earnings for our partners.</p>
<p>We believe the third party tools being used to publish content from the ePN RSS Feeds will update as necessary, if not already, to account for this new link structure and direct users to the correct pages on eBay. Also, as recommended by others in this thread it’s a good idea to consult the resources available through these third parties for further assistance. Please note that there are no issues with the RSS Feed URLs and links when taken directly from the publisher interface.</p>
<p>Thanks again for your patience,</p>
<p>Casey</p></blockquote>
<p><a href="http://forums.ebay.com/db2/topic/Ebay-Partner-Network/Rss-Feed-Bug/520181276&amp;start=60" target="_blank">You can read the full thread here</a>. So it definitely looks like there are some serious backend changes in the works. I&#8217;ll be slowly (or quickly depending on when they enforce the change) converting my rover links to follow these new variables.  The BANS issue may have been related to urlencoding, not sure.</p>


<p>Related posts:<ol><li><a href='http://www.money-code.com/2010/01/pay-attention-to-your-roll-your-own-epn-sites/' rel='bookmark' title='Permanent Link: Pay Attention to your Roll-Your-Own EPN sites'>Pay Attention to your Roll-Your-Own EPN sites</a></li>
<li><a href='http://www.money-code.com/2007/10/paging-ebay-rss-results/' rel='bookmark' title='Permanent Link: Paging eBay RSS results'>Paging eBay RSS results</a></li>
<li><a href='http://www.money-code.com/2008/04/epn-editorkit-transition/' rel='bookmark' title='Permanent Link: EPN EditorKit Transition'>EPN EditorKit Transition</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.money-code.com/2010/01/epn-change-to-rss/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pay Attention to your Roll-Your-Own EPN sites</title>
		<link>http://www.money-code.com/2010/01/pay-attention-to-your-roll-your-own-epn-sites/</link>
		<comments>http://www.money-code.com/2010/01/pay-attention-to-your-roll-your-own-epn-sites/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 02:44:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Affiliate Marketing]]></category>
		<category><![CDATA[EPN]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[bans]]></category>
		<category><![CDATA[cloaking]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[SEO]]></category>

		<guid isPermaLink="false">http://www.money-code.com/?p=607</guid>
		<description><![CDATA[Yesterday I noticed that my EPN sites were having trouble with their searching capability. It appears that eBay changed some things related to their RSS feed on my searches, luckily my category RSS were okay, for the time being. This recent change affected my parser that extracts the Auction ID for my SEO links (internalized [...]


Related posts:<ol><li><a href='http://www.money-code.com/2010/01/epn-change-to-rss/' rel='bookmark' title='Permanent Link: EPN change to RSS'>EPN change to RSS</a></li>
<li><a href='http://www.money-code.com/2009/07/epn-newsletter-referring-url-visibilty/' rel='bookmark' title='Permanent Link: EPN Newsletter &#8211; Referring URL Visibilty'>EPN Newsletter &#8211; Referring URL Visibilty</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>
</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%2F2010%2F01%2Fpay-attention-to-your-roll-your-own-epn-sites%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2010%2F01%2Fpay-attention-to-your-roll-your-own-epn-sites%2F" height="61" width="51" /></a></div><p>Yesterday I noticed that my EPN sites were having trouble with their searching capability. It appears that eBay changed some things related to their RSS feed on my searches, luckily my category RSS were okay, for the time being. This recent change affected my parser that extracts the Auction ID for my SEO links (internalized links to eBay). I also noticed that they named a few new variables (this could be old news for many, but it was new to me)</p>
<p>icep_item=xxxxxx<br />
ipn=psmain<br />
icp_vectorid=xxxxxxx<br />
kwid=xxxxxx<br />
mtid=xxxx<br />
kw=rss<br />
icep_ff3=2</p>
<p>I was able to restore search functionality, but I only updated my rover redirects on one site to verify that this change did NOT impact my click counts for that site, and I&#8217;ll be migrating my rover code to this new style. I know I could pull this rover URL directly from the RSS result, but I&#8217;m not passing extraneous info via the querystring on my redirect. I may reconsider this though.</p>
<p>Today, Dave at <a href="http://buildanichestoreblog.blogspot.com/" target="_blank">BuildANicheStoreBlog.com</a> had a post stating that if you have BANS sites that have Cloak Affiliate Links in box #4 you may be experiencing problems. This seems awfully coincidental to my issues noticed yesterday. Apparently, those users are directed to a &#8216;Page Not Responding&#8217; at eBay. You can read Dave&#8217;s full post <a href="http://buildanichestoreblog.blogspot.com/2010/01/check-your-bans-sites-that-cloak-urls.html" target="_blank">here</a>.</p>


<p>Related posts:<ol><li><a href='http://www.money-code.com/2010/01/epn-change-to-rss/' rel='bookmark' title='Permanent Link: EPN change to RSS'>EPN change to RSS</a></li>
<li><a href='http://www.money-code.com/2009/07/epn-newsletter-referring-url-visibilty/' rel='bookmark' title='Permanent Link: EPN Newsletter &#8211; Referring URL Visibilty'>EPN Newsletter &#8211; Referring URL Visibilty</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>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.money-code.com/2010/01/pay-attention-to-your-roll-your-own-epn-sites/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Issues with CJNiche WordPress Plugin</title>
		<link>http://www.money-code.com/2010/01/issues-with-cjniche-wordpress-plugin/</link>
		<comments>http://www.money-code.com/2010/01/issues-with-cjniche-wordpress-plugin/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 02:36:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Affiliate Marketing]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[cj]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[niche]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.money-code.com/?p=602</guid>
		<description><![CDATA[So I&#8217;ve been working with the cjniche plugin. Overall, it&#8217;s a pretty good plugin, but I definitely have some issues with it. I noticed that a few of my requests were getting the dreaded PHP warning:
Warning: Invalid argument supplied for foreach() in
/var/www/wouldnt/you/like/to/know/wp-content/
plugins/cjniche/cjniche.php on line 79
Want to see if it&#8217;s a wide spread problem on the [...]


Related posts:<ol><li><a href='http://www.money-code.com/2009/10/simple-modification-to-fd-feedburner-plugin/' rel='bookmark' title='Permanent Link: Simple modification to FD Feedburner Plugin'>Simple modification to FD Feedburner Plugin</a></li>
<li><a href='http://www.money-code.com/2007/09/bans-security-issues-are-being-addressed/' rel='bookmark' title='Permanent Link: BANS &#8211; security issues are being addressed'>BANS &#8211; security issues are being addressed</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%2F2010%2F01%2Fissues-with-cjniche-wordpress-plugin%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2010%2F01%2Fissues-with-cjniche-wordpress-plugin%2F" height="61" width="51" /></a></div><p>So I&#8217;ve been working with the<a href="http://wpnicheground.com/2009/11/cjniche-commission-junction-wordpress-plugin-2/" target="_blank"> cjniche plugin</a>. Overall, it&#8217;s a pretty good plugin, but I definitely have some issues with it. I noticed that a few of my requests were getting the dreaded PHP warning:</p>
<pre>Warning: Invalid argument supplied for foreach() in
/var/www/wouldnt/you/like/to/know/wp-content/
plugins/cjniche/cjniche.php on line 79</pre>
<p>Want to see if it&#8217;s a wide spread problem on the interwebby? Check out this <a href="http://www.google.com/#hl=en&amp;source=hp&amp;q=cjniche+%22Warning%3A+Invalid+argument+supplied+for+foreach%28%29%22&amp;aq=f&amp;aql=&amp;aqi=&amp;oq=&amp;fp=4787d6a9aecc9114" target="_blank">Google search on the topic</a>.</p>
<p>The line number may vary with yours, I added some extra special customizations to the plugin. Googling around on this, I see constant references to this error relating to this plugin. I also see crazy recommendations like deactivating and reactivating the plugin. Reminds me of the &#8216;did you reboot your computer&#8217; and if the answer it &#8216;yes&#8217;, you follow up with &#8216;how many times&#8217;. Odd how some things just go away. Well, I wasn&#8217;t buying it.</p>
<p>It is true if you add a space to the advertiserIds or dork up your CJ Key you&#8217;ll get the same error, but I was experiencing intermittent errors. It would work a few of the times, then not work the other times. That would have NOTHING to do with variable values stored in the database. I did some digging (which is hard with this particular plugin since they encode everything.. really?).  I was able to get to the root of the problem.</p>
<p>If you&#8217;re getting this error every time, the plugin is not receiving a proper XML response CJ and that is why the foreach is blowing up. Unfortunately, the plugin is not checking for a good product set return from CJ and just explodes. Now, if you&#8217;re getting this error some of the times, the problem is very similar. I was able to echo the XML returning during a failure and this is what I saw:</p>
<pre>[error-message] =&gt;; The server is currently at
capacity or down for maintenance. Please try again later.</pre>
<p>Wow, now that helps shed some light on the problem for sure. Looks like CJ is having problems. This is my biggest irritation dealing with CJ&#8217;s datafeed. I&#8217;ve mentioned that in the past that it&#8217;s just not reliable. This plugin is nice for something quick and if you&#8217;re working with small data sets or small merchants, this probably works really well. If you&#8217;re dealing with larger product catalogs, the keyword filtering is obviously going to take longer and probably cause issues with many requests. Now this is an assumption. I&#8217;m not sure if yesterday and today are the only two days having problems.. who knows. What I wanted to do with this post was shed some light with the PHP error and this plugin. I definitely see mention of it in many places.</p>
<p>I&#8217;ve written some error handling in the plugin to catch vs. explode when this occurs, but I might need to work on a caching solution to fall back on a stored data set if it has trouble.</p>


<p>Related posts:<ol><li><a href='http://www.money-code.com/2009/10/simple-modification-to-fd-feedburner-plugin/' rel='bookmark' title='Permanent Link: Simple modification to FD Feedburner Plugin'>Simple modification to FD Feedburner Plugin</a></li>
<li><a href='http://www.money-code.com/2007/09/bans-security-issues-are-being-addressed/' rel='bookmark' title='Permanent Link: BANS &#8211; security issues are being addressed'>BANS &#8211; security issues are being addressed</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/2010/01/issues-with-cjniche-wordpress-plugin/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Simple modification to FD Feedburner Plugin</title>
		<link>http://www.money-code.com/2009/10/simple-modification-to-fd-feedburner-plugin/</link>
		<comments>http://www.money-code.com/2009/10/simple-modification-to-fd-feedburner-plugin/#comments</comments>
		<pubDate>Sat, 31 Oct 2009 18:38:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[feed]]></category>
		<category><![CDATA[feedburner]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.money-code.com/?p=596</guid>
		<description><![CDATA[Today for one of my sites, I needed to populate a Facebook page with a feed, but I didn&#8217;t want the entire post as the &#8216;note&#8217;. I found a great plugin called Feed Facebook, Leave Facebook that leaves a partial feed with a link to &#8216;leave Facebook&#8217; to your site. This is EXACTLY what I [...]


Related posts:<ol><li><a href='http://www.money-code.com/2010/01/issues-with-cjniche-wordpress-plugin/' rel='bookmark' title='Permanent Link: Issues with CJNiche WordPress Plugin'>Issues with CJNiche WordPress Plugin</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>
<li><a href='http://www.money-code.com/2009/08/including-your-wordpress-blogs-to-a-external-website/' rel='bookmark' title='Permanent Link: Including your WordPress blogs to a external website'>Including your WordPress blogs to a external website</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%2F10%2Fsimple-modification-to-fd-feedburner-plugin%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2009%2F10%2Fsimple-modification-to-fd-feedburner-plugin%2F" height="61" width="51" /></a></div><p>Today for one of my sites, I needed to populate a Facebook page with a feed, but I didn&#8217;t want the entire post as the &#8216;note&#8217;. I found a great plugin called <a href="http://www.keyvan.net/code/feed-facebook-leave-facebook/" target="_blank">Feed Facebook, Leave Facebook</a> that leaves a partial feed with a link to &#8216;leave Facebook&#8217; to your site. This is EXACTLY what I needed, but I was having problem with my <a href="http://flagrantdisregard.com/feedburner/" target="_blank">FD Feedburner Plugin</a> which auto-magically converts my RSS feeds to feedburner feeds. In this particular case, I needed to exclude a single feed from this. Unfortunately, this is not a configuration option.</p>
<p>So I&#8217;m posting this mainly for myself in case there is a plugin update and I need to know how I did this the first time, but I can see that few might find this useful.</p>
<p>Basically in the feedburner_redirect() function, we need to add a conditional:</p>
<div class="dean_ch" style="white-space: wrap;"><span class="kw1">if</span> <span class="br0">&#40;</span><span class="re0">$feed_url</span> != <span class="kw2">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Redirect the feed</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">&quot;Location: &quot;</span>.<span class="re0">$feed_url</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/die"><span class="kw3">die</span></a>;<br />
<span class="br0">&#125;</span></div>
<p>Needs to be changed to this:</p>
<div class="dean_ch" style="white-space: wrap;"><span class="kw1">if</span> <span class="br0">&#40;</span><span class="re0">$feed_url</span> != <span class="kw2">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Redirect the feed</span><br />
&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;facebook&#8217;</span>,<span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st0">&#8216;REQUEST_URI&#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; <a href="http://www.php.net/header"><span class="kw3">header</span></a><span class="br0">&#40;</span><span class="st0">&quot;Location: &quot;</span>.<span class="re0">$feed_url</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/die"><span class="kw3">die</span></a>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></div>
<p>The feed url that Facebook will be using looks similar to this : http://www.yourdomain.com/feed?feedfacebook, if we detect this in the REQUEST_URI, we do nothing with the redirect. Now Facebook will be happy with our new feed, while any other requests to our site&#8217;s feed will be directed to Feedburner.</p>


<p>Related posts:<ol><li><a href='http://www.money-code.com/2010/01/issues-with-cjniche-wordpress-plugin/' rel='bookmark' title='Permanent Link: Issues with CJNiche WordPress Plugin'>Issues with CJNiche WordPress Plugin</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>
<li><a href='http://www.money-code.com/2009/08/including-your-wordpress-blogs-to-a-external-website/' rel='bookmark' title='Permanent Link: Including your WordPress blogs to a external website'>Including your WordPress blogs to a external website</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.money-code.com/2009/10/simple-modification-to-fd-feedburner-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Update WordPress!</title>
		<link>http://www.money-code.com/2009/10/update-wordpress/</link>
		<comments>http://www.money-code.com/2009/10/update-wordpress/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 15:37:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Affiliate Marketing]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.money-code.com/?p=592</guid>
		<description><![CDATA[Okay, looks like WordPress released a &#8216;hardened&#8217; release for 2.8 which will jack your release version to 2.8.5. It&#8217;s very important to stay upgraded to ensure that your sites will run properly, but more importantly to maintain security. You don&#8217;t want your money-making sites to go down, or to have your account suspended due to [...]


Related posts:<ol><li><a href='http://www.money-code.com/2009/07/thinking-about-security-for-affiliate-marketing/' rel='bookmark' title='Permanent Link: Thinking about security for Affiliate Marketing'>Thinking about security for Affiliate Marketing</a></li>
<li><a href='http://www.money-code.com/2009/08/twitter-troubles/' rel='bookmark' title='Permanent Link: Twitter troubles'>Twitter troubles</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%2F10%2Fupdate-wordpress%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2009%2F10%2Fupdate-wordpress%2F" height="61" width="51" /></a></div><p><img class="alignleft size-full wp-image-351" title="icon_big" src="http://www.money-code.com/wp-content/uploads/2009/06/icon_big.jpg" alt="icon_big" width="150" height="151" />Okay, looks like WordPress released a &#8216;hardened&#8217; release for 2.8 which will jack your release version to 2.8.5. It&#8217;s very important to stay upgraded to ensure that your sites will run properly, but more importantly to maintain security. You don&#8217;t want your money-making sites to go down, or to have your account suspended due to your site being compromised. As they say, &#8220;A ounce of prevention is worth a pound of cure&#8221;.</p>
<p>Details of the release can be found here: <a href="http://wordpress.org/development/2009/10/wordpress-2-8-5-hardening-release/" target="_blank">http://wordpress.org/development/2009/10/wordpress-2-8-5-hardening-release/</a></p>
<p>The headline changes in this release are:</p>
<ul>
<li>A fix for the Trackback Denial-of-Service attack that is currently being seen.</li>
<li>Removal of areas within the code where php code in variables was evaluated.</li>
<li>Switched the file upload functionality to be whitelisted for all users including Admins.</li>
<li>Retiring of the two importers of Tag data from old plugins.</li>
</ul>


<p>Related posts:<ol><li><a href='http://www.money-code.com/2009/07/thinking-about-security-for-affiliate-marketing/' rel='bookmark' title='Permanent Link: Thinking about security for Affiliate Marketing'>Thinking about security for Affiliate Marketing</a></li>
<li><a href='http://www.money-code.com/2009/08/twitter-troubles/' rel='bookmark' title='Permanent Link: Twitter troubles'>Twitter troubles</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/10/update-wordpress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>EPN Tracking Image</title>
		<link>http://www.money-code.com/2009/10/epn-tracking-image/</link>
		<comments>http://www.money-code.com/2009/10/epn-tracking-image/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 16:19:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[EPN]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[qcp]]></category>
		<category><![CDATA[quality click pricing]]></category>
		<category><![CDATA[tracking]]></category>

		<guid isPermaLink="false">http://www.money-code.com/?p=583</guid>
		<description><![CDATA[A good friend of mine, just starting out in EPN, asked me if I add a tracking pixel as suggested by the link tool. Hmm? I haven&#8217;t ccreated any links using the tool in over a year, so I didn&#8217;t see mention of that. I do remember that one of the EPN webinars that someone [...]


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/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/2008/04/epn-editorkit-transition/' rel='bookmark' title='Permanent Link: EPN EditorKit Transition'>EPN EditorKit Transition</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%2F10%2Fepn-tracking-image%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2009%2F10%2Fepn-tracking-image%2F" height="61" width="51" /></a></div><p><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 good friend of mine, just starting out in EPN, asked me if I add a tracking pixel as suggested by the link tool. Hmm? I haven&#8217;t ccreated any links using the tool in over a year, so I didn&#8217;t see mention of that. I do remember that one of the EPN webinars that someone mentioned that they wanted to see some more impression tracking for more publish transparency, but I didn&#8217;t hear more on the subject.</p>
<p>I quickly went to the tool and generated some links and saw the mention&#8230;</p>
<blockquote><p>Tip: We recommend serving at least one impression pixel per Campaign on every page that has eBay links. For more info, click the help link to the left and contact us.</p></blockquote>
<p>As some of you know I roll my own EPN sites (No BANS) so I needed to quickly add this tracking image on my sites. All of my sites have a &#8217;store&#8217; section, so within that template I added the following PHP code at the bottom:</p>
<div class="dean_ch" style="white-space: wrap;"><a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&#8216;&lt;img style=&quot;text-decoration:none;border:0;padding:0;margin:0;&quot; src=&quot;http://rover.ebay.com/roverimp/1/711-53200-19255-0/1?ff3=1&amp;amp;pub=123413241432&amp;amp;toolid=10001&amp;amp;campid=&#8217;</span>.EPNID.<span class="st0">&#8216;&amp;amp;customid=&amp;amp;mpt=[CACHEBUSTER]&quot; alt=&quot;&quot; /&gt;&#8217;</span>;</div>
<p>The EPNID variable is a PHP constant that contains my campid for every site. I&#8217;m not seeing increased impressions in my campaigns. I had &#8217;some&#8217; impressions before, but those were from various pages that had Editor Kits, but now I&#8217;m seeing proper page impressions for my RSS and API pages.</p>
<p>I wanted to post this in case others like me, didn&#8217;t see the &#8217;suggestion&#8217;.</p>
<p>Side note, EPN&#8217;s QCP is still better than my daily commissions under the old system. I&#8217;ll be officially ramping up my EPN development again. I&#8217;ve been working on Amazon store fronts during the last month and half, and seeing some &#8216;okay&#8217; earnings from there. Still nowhere near my EPN earnings, but I&#8217;ve been learning alot about what works.. and what doesn&#8217;t. I&#8217;m hoping that these Amazon sites will really pay off during the holiday shopping spree.</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/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/2008/04/epn-editorkit-transition/' rel='bookmark' title='Permanent Link: EPN EditorKit Transition'>EPN EditorKit Transition</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.money-code.com/2009/10/epn-tracking-image/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Finding BrowseNodes for Amazon API search (AWS)</title>
		<link>http://www.money-code.com/2009/09/finding-browsenodes-for-amazon-api-search-aws/</link>
		<comments>http://www.money-code.com/2009/09/finding-browsenodes-for-amazon-api-search-aws/#comments</comments>
		<pubDate>Wed, 23 Sep 2009 15:56:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[reviewazon]]></category>
		<category><![CDATA[web service]]></category>
		<category><![CDATA[wpreviewsite]]></category>

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


Related posts:<ol><li><a href='http://www.money-code.com/2009/08/amazon-product-api-signaturedoesnotmatch-error-response/' rel='bookmark' title='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>Amazon Product API: SignatureDoesNotMatch error response</title>
		<link>http://www.money-code.com/2009/08/amazon-product-api-signaturedoesnotmatch-error-response/</link>
		<comments>http://www.money-code.com/2009/08/amazon-product-api-signaturedoesnotmatch-error-response/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 04:18:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Affiliate Marketing]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[store fronts]]></category>
		<category><![CDATA[web services]]></category>
		<category><![CDATA[xml]]></category>

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


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


<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/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/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>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.money-code.com/2009/08/amazon-product-api-signaturedoesnotmatch-error-response/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Including your WordPress blogs to a external website</title>
		<link>http://www.money-code.com/2009/08/including-your-wordpress-blogs-to-a-external-website/</link>
		<comments>http://www.money-code.com/2009/08/including-your-wordpress-blogs-to-a-external-website/#comments</comments>
		<pubDate>Sun, 09 Aug 2009 22:47:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[crontab]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.money-code.com/?p=522</guid>
		<description><![CDATA[I&#8217;ve been working on various CJ and EPN store fronts lately. Not creating new ones but working SEO and fattening them up with more reasons to visit. One of my popular ones I thought it would be cool to introduce a blog where I can promote more CJ items and promote other sites (treating it [...]


Related posts:<ol><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>
<li><a href='http://www.money-code.com/2009/07/including-twitter-updates-in-your-site/' rel='bookmark' title='Permanent Link: Including Twitter updates in your site'>Including Twitter updates in your site</a></li>
<li><a href='http://www.money-code.com/2007/09/capture-search-data-on-your-site/' rel='bookmark' title='Permanent Link: Capture search data on your site'>Capture search data on your site</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%2Fincluding-your-wordpress-blogs-to-a-external-website%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2009%2F08%2Fincluding-your-wordpress-blogs-to-a-external-website%2F" height="61" width="51" /></a></div><p>I&#8217;ve been working on various CJ and EPN store fronts lately. Not creating new ones but working SEO and fattening them up with more reasons to visit. One of my popular ones I thought it would be cool to introduce a blog where I can promote more CJ items and promote other sites (treating it like a hub blog of sorts). I did not want to include the WordPress blog in a subdirectory, but wanted it as a sub domain (http://blog.test.com). This is located on another server (complicated circumstances), but I wanted to include recent posts within the home page of the store front.</p>
<p>I thought this over. I was originally just going to suck in the RSS feed from the blog, but I didn&#8217;t want the blog to impact performance in anyway. Performance can be impacted with slow delivery of the RSS (I&#8217;m already sucking in a eBay RSS feed there as well), or worse the RSS times out or has issues. I didn&#8217;t want that impression left to the potential customer.</p>
<p>I thought it might be cool to create a cron job to suck in the recent posts every hour via direct connection to the database on the remote server and populate a local database (the storefront). This way the &#8216;fetch&#8217; process is outside the performance of the site, and the presentation of the feed would be handled by the local mysql database (very quick). Plus.. it sounded like a nerdy thing to do this morning.</p>
<p>To do this, I created a local wp_posts table in the local database (this is not the WordPress database). I&#8217;m only needing a few things: date, title, comments, etc.</p>
<p>Here is the schema:</p>
<div class="dean_ch" style="white-space: wrap;"><span class="kw1">CREATE</span> <span class="kw1">TABLE</span> <span class="kw1">IF</span> <span class="kw1">NOT</span> <span class="kw1">EXISTS</span> <span class="st0">`wp_posts`</span> <span class="br0">&#40;</span><br />
<span class="st0">`ID`</span> bigint<span class="br0">&#40;</span><span class="nu0">20</span><span class="br0">&#41;</span> <span class="kw1">UNSIGNED</span> <span class="kw1">NOT</span> <span class="kw1">NULL</span> <span class="kw1">AUTO_INCREMENT</span>,<br />
<span class="st0">`post_date`</span> datetime <span class="kw1">NOT</span> <span class="kw1">NULL</span> <span class="kw1">DEFAULT</span> <span class="st0">&#8216;0000-00-00 00:00:00&#8242;</span>,<br />
<span class="st0">`post_title`</span> text <span class="kw1">NOT</span> <span class="kw1">NULL</span>,<br />
<span class="st0">`post_name`</span> varchar<span class="br0">&#40;</span><span class="nu0">200</span><span class="br0">&#41;</span> <span class="kw1">NOT</span> <span class="kw1">NULL</span> <span class="kw1">DEFAULT</span> <span class="st0">&#8221;</span>,<br />
<span class="st0">`post_type`</span> varchar<span class="br0">&#40;</span><span class="nu0">20</span><span class="br0">&#41;</span> <span class="kw1">NOT</span> <span class="kw1">NULL</span> <span class="kw1">DEFAULT</span> <span class="st0">&#8216;post&#8217;</span>,<br />
<span class="st0">`comment_count`</span> bigint<span class="br0">&#40;</span><span class="nu0">20</span><span class="br0">&#41;</span> <span class="kw1">NOT</span> <span class="kw1">NULL</span> <span class="kw1">DEFAULT</span> <span class="st0">&#8216;0&#8242;</span>,<br />
<span class="kw1">PRIMARY</span> <span class="kw1">KEY</span>  <span class="br0">&#40;</span><span class="st0">`ID`</span><span class="br0">&#41;</span><br />
<span class="br0">&#41;</span> ENGINE=MyISAM  <span class="kw1">DEFAULT</span> CHARSET=utf8 <span class="kw1">AUTO_INCREMENT</span>=<span class="nu0">1</span></div>
<p>Next, I made the &#8216;worker&#8217; PHP CLI script that will run on the linux server in the background. This is not executed via a browser but using the PHP executable to parse it. It basically connects to the remote (WordPress) database and queries the latest 10 records. It then truncates my local database and repopulates it with new info.</p>
<div class="dean_ch" style="white-space: wrap;"><span class="co2">#!/usr/bin/php</span><br />
<span class="kw2">&lt;?php</span><br />
<a href="http://www.php.net/define"><span class="kw3">define</span></a><span class="br0">&#40;</span><span class="st0">&#8216;DB_NAME&#8217;</span>, <span class="st0">&#8216;test&#8217;</span><span class="br0">&#41;</span>;<br />
<a href="http://www.php.net/define"><span class="kw3">define</span></a><span class="br0">&#40;</span><span class="st0">&#8216;DB_USER&#8217;</span>, <span class="st0">&#8216;test&#8217;</span><span class="br0">&#41;</span>;<br />
<a href="http://www.php.net/define"><span class="kw3">define</span></a><span class="br0">&#40;</span><span class="st0">&#8216;DB_PASSWORD&#8217;</span>, <span class="st0">&#8216;test&#8217;</span><span class="br0">&#41;</span>;<br />
<a href="http://www.php.net/define"><span class="kw3">define</span></a><span class="br0">&#40;</span><span class="st0">&#8216;DB_HOST&#8217;</span>, <span class="st0">&#8216;mysql.test.com&#8217;</span><span class="br0">&#41;</span>;<br />
<a href="http://www.php.net/define"><span class="kw3">define</span></a><span class="br0">&#40;</span><span class="st0">&#8216;LOCAL_DB_NAME&#8217;</span>, <span class="st0">&#8216;test&#8217;</span><span class="br0">&#41;</span>;<br />
<a href="http://www.php.net/define"><span class="kw3">define</span></a><span class="br0">&#40;</span><span class="st0">&#8216;LOCAL_DB_USER&#8217;</span>, <span class="st0">&#8216;test&#8217;</span><span class="br0">&#41;</span>;<br />
<a href="http://www.php.net/define"><span class="kw3">define</span></a><span class="br0">&#40;</span><span class="st0">&#8216;LOCAL_DB_PASSWORD&#8217;</span>, <span class="st0">&#8216;test&#8217;</span><span class="br0">&#41;</span>;<br />
<a href="http://www.php.net/define"><span class="kw3">define</span></a><span class="br0">&#40;</span><span class="st0">&#8216;LOCAL_DB_HOST&#8217;</span>, <span class="st0">&#8216;localhost&#8217;</span><span class="br0">&#41;</span>;<br />
<a href="http://www.php.net/mysql_connect"><span class="kw3">mysql_connect</span></a><span class="br0">&#40;</span>DB_HOST, DB_USER, DB_PASSWORD<span class="br0">&#41;</span>;<br />
@<a href="http://www.php.net/mysql_select_db"><span class="kw3">mysql_select_db</span></a><span class="br0">&#40;</span>DB_NAME<span class="br0">&#41;</span> or <a href="http://www.php.net/die"><span class="kw3">die</span></a><span class="br0">&#40;</span><span class="st0">&quot;Unable to select database&quot;</span><span class="br0">&#41;</span>;<br />
<span class="re0">$sql</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= <span class="st0">&quot;SELECT post_date, post_type, comment_count, post_title, post_name<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FROM wp_8kzhbt_posts<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WHERE post_type = &#8216;post&#8217;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ORDER BY post_date DESC<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LIMIT 10&quot;</span>;<br />
<span class="kw1">if</span><span class="br0">&#40;</span>!<span class="re0">$rs</span> = <a href="http://www.php.net/mysql_query"><span class="kw3">mysql_query</span></a><span class="br0">&#40;</span><span class="re0">$sql</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&quot;Database Error<span class="es0">\n</span>&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <a href="http://www.php.net/mysql_error"><span class="kw3">mysql_error</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="st0">&quot;<span class="es0">\n</span>&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="re0">$sql</span>.<span class="st0">&quot;<span class="es0">\n</span>&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/exit"><span class="kw3">exit</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="re0">$postArr</span> &nbsp; &nbsp; &nbsp; &nbsp;= <a href="http://www.php.net/array"><span class="kw3">array</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/mysql_num_rows"><span class="kw3">mysql_num_rows</span></a><span class="br0">&#40;</span><span class="re0">$rs</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$num</span> &nbsp; &nbsp;= <span class="nu0">0</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">while</span><span class="br0">&#40;</span><span class="re0">$row</span> = <a href="http://www.php.net/mysql_fetch_object"><span class="kw3">mysql_fetch_object</span></a><span class="br0">&#40;</span><span class="re0">$rs</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="re0">$postArr</span><span class="br0">&#91;</span><span class="re0">$num</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st0">&#8216;post_date&#8217;</span><span class="br0">&#93;</span> &nbsp; &nbsp; = <span class="re0">$row</span>-&gt;<span class="me1">post_date</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$postArr</span><span class="br0">&#91;</span><span class="re0">$num</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st0">&#8216;post_type&#8217;</span><span class="br0">&#93;</span> &nbsp; &nbsp; = <span class="re0">$row</span>-&gt;<span class="me1">post_type</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$postArr</span><span class="br0">&#91;</span><span class="re0">$num</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st0">&#8216;comment_count&#8217;</span><span class="br0">&#93;</span> = <span class="re0">$row</span>-&gt;<span class="me1">comment_count</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$postArr</span><span class="br0">&#91;</span><span class="re0">$num</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st0">&#8216;post_title&#8217;</span><span class="br0">&#93;</span> &nbsp; &nbsp;= <span class="re0">$row</span>-&gt;<span class="me1">post_title</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$postArr</span><span class="br0">&#91;</span><span class="re0">$num</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st0">&#8216;post_name&#8217;</span><span class="br0">&#93;</span> &nbsp; &nbsp; = <span class="re0">$row</span>-&gt;<span class="me1">post_name</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$num</span>++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span><br />
<a href="http://www.php.net/mysql_free_result"><span class="kw3">mysql_free_result</span></a><span class="br0">&#40;</span><span class="re0">$rs</span><span class="br0">&#41;</span>;</p>
<p><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">$postArr</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; <span class="co1">// connect to local db</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// clean the table</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// re-populate</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$localCon</span> = <a href="http://www.php.net/mysql_connect"><span class="kw3">mysql_connect</span></a><span class="br0">&#40;</span>LOCAL_DB_HOST, LOCAL_DB_USER, LOCAL_DB_PASSWORD<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; @<a href="http://www.php.net/mysql_select_db"><span class="kw3">mysql_select_db</span></a><span class="br0">&#40;</span>LOCAL_DB_NAME<span class="br0">&#41;</span> or <a href="http://www.php.net/die"><span class="kw3">die</span></a><span class="br0">&#40;</span><span class="st0">&quot;Unable to select database&quot;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$sql</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= <span class="st0">&quot;TRUNCATE TABLE `wp_posts`&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span>!<a href="http://www.php.net/mysql_query"><span class="kw3">mysql_query</span></a><span class="br0">&#40;</span><span class="re0">$sql</span>,<span class="re0">$localCon</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; <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&quot;Database Error &#8211; Local Connection<span class="es0">\n</span>&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/exit"><span class="kw3">exit</span></a><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="kw1">for</span><span class="br0">&#40;</span><span class="re0">$num</span> = <span class="nu0">0</span>; <span class="re0">$num</span> &lt; <a href="http://www.php.net/sizeof"><span class="kw3">sizeof</span></a><span class="br0">&#40;</span><span class="re0">$postArr</span><span class="br0">&#41;</span>; <span class="re0">$num</span>++<span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$sql</span> &nbsp; &nbsp;= <span class="st0">&quot;INSERT INTO wp_posts(post_date,post_type,comment_count,post_title,post_name)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VALUES(&#8216;&quot;</span>.<span class="re0">$postArr</span><span class="br0">&#91;</span><span class="re0">$num</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st0">&#8216;post_date&#8217;</span><span class="br0">&#93;</span>.<span class="st0">&quot;&#8217;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#8216;&quot;</span>.<span class="re0">$postArr</span><span class="br0">&#91;</span><span class="re0">$num</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st0">&#8216;post_type&#8217;</span><span class="br0">&#93;</span>.<span class="st0">&quot;&#8217;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#8216;&quot;</span>.<span class="re0">$postArr</span><span class="br0">&#91;</span><span class="re0">$num</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st0">&#8216;comment_count&#8217;</span><span class="br0">&#93;</span>.<span class="st0">&quot;&#8217;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#8216;&quot;</span>.<span class="re0">$postArr</span><span class="br0">&#91;</span><span class="re0">$num</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st0">&#8216;post_title&#8217;</span><span class="br0">&#93;</span>.<span class="st0">&quot;&#8217;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#8216;&quot;</span>.<span class="re0">$postArr</span><span class="br0">&#91;</span><span class="re0">$num</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st0">&#8216;post_name&#8217;</span><span class="br0">&#93;</span>.<span class="st0">&quot;&#8217;)&quot;</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/mysql_query"><span class="kw3">mysql_query</span></a><span class="br0">&#40;</span><span class="re0">$sql</span>,<span class="re0">$localCon</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; <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&quot;Database Error &#8211; Insert Local Connection<span class="es0">\n</span>&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/exit"><span class="kw3">exit</span></a><span class="br0">&#40;</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 />
<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">$postArr</span><span class="br0">&#41;</span>;<br />
<span class="kw2">?&gt;</span></div>
<p>This script is added to the cron.hourly of the server is executed on a hourly basis. You could add this to crontab as well.</p>
<p>The next piece is on the storefront site itself. I query the local database and ask for the entries and reassembly my &#8216;permalink&#8217;. I could have used the guid field in the database, but it seems to convert a few of the URLs to permalinks. Not sure why, so I figured I would just create it. You may need to adjust it to fit your format.</p>
<div class="dean_ch" style="white-space: wrap;">
<span class="kw2">&lt;?php</span><br />
<span class="re0">$sql</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&quot;SELECT *<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FROM wp_posts<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ORDER BY post_date DESC&quot;</span>;<br />
<span class="kw1">if</span><span class="br0">&#40;</span>!<span class="re0">$rs</span> = <a href="http://www.php.net/mysql_query"><span class="kw3">mysql_query</span></a><span class="br0">&#40;</span><span class="re0">$sql</span>,<span class="re0">$connect</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/trigger_error"><span class="kw3">trigger_error</span></a><span class="br0">&#40;</span><a href="http://www.php.net/sprintf"><span class="kw3">sprintf</span></a><span class="br0">&#40;</span><span class="st0">&quot;SQL Error: %d: %s<span class="es0">\n</span>&quot;</span> , <a href="http://www.php.net/mysql_errno"><span class="kw3">mysql_errno</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span>, <a href="http://www.php.net/mysql_error"><span class="kw3">mysql_error</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>, <span class="kw2">E_USER_ERROR</span><span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">if</span><span class="br0">&#40;</span><a href="http://www.php.net/mysql_num_rows"><span class="kw3">mysql_num_rows</span></a><span class="br0">&#40;</span><span class="re0">$rs</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><span class="kw2">?&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;div <span class="kw2">class</span>=<span class="st0">&quot;header&quot;</span>&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Recent Blog Posts<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;&lt;?<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">while</span><span class="br0">&#40;</span><span class="re0">$row</span> = <a href="http://www.php.net/mysql_fetch_object"><span class="kw3">mysql_fetch_object</span></a><span class="br0">&#40;</span><span class="re0">$rs</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="re0">$post_date</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="re0">$row</span>-&gt;<span class="me1">post_date</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$post_title</span>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; = <span class="re0">$row</span>-&gt;<span class="me1">post_title</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$post_name</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="re0">$row</span>-&gt;<span class="me1">post_name</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$comments</span>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; = <span class="re0">$row</span>-&gt;<span class="me1">comment_count</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// assemble the permalink</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// http://blog.test.com/year/mo/day/post-name/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$dateArr</span>&nbsp; &nbsp; &nbsp; &nbsp; &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; &#8216;</span>,<span class="re0">$post_date</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$dateSeg</span>&nbsp; &nbsp; &nbsp; &nbsp; &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">$dateArr</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$year</span>&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="re0">$dateSeg</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$month</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="re0">$dateSeg</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$day</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="re0">$dateSeg</span><span class="br0">&#91;</span><span class="nu0">2</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$formatDate</span>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; = showDate<span class="br0">&#40;</span><span class="re0">$post_date</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$url</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&#8216;http://blog.test.com/&#8217;</span>.<span class="re0">$year</span>.<span class="st0">&#8216;/&#8217;</span>.<span class="re0">$month</span>.<span class="st0">&#8216;/&#8217;</span>.<span class="re0">$day</span>.<span class="st0">&#8216;/&#8217;</span>.<span class="re0">$post_name</span>;?&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div style=<span class="st0">&quot;margin-bottom: 8px&quot;</span>&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;a href=<span class="st0">&quot;&lt;?=$url?&gt;&quot;</span> target=<span class="st0">&quot;_blank&quot;</span> rel=<span class="st0">&quot;dofollow&quot;</span> style=<span class="st0">&quot;font-weight: bold;&quot;</span>&gt;&lt;?=<span class="re0">$post_title</span>?&gt;&lt;/a&gt; <span class="kw2">&lt;?</span>=<span class="re0">$formatDate</span>?&gt; <span class="br0">&#40;</span><span class="kw2">&lt;?</span>=<span class="re0">$comments</span>?&gt; comments<span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;&lt;?<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span><br />
<a href="http://www.php.net/mysql_free_result"><span class="kw3">mysql_free_result</span></a><span class="br0">&#40;</span><span class="re0">$rs</span><span class="br0">&#41;</span>;?&gt;</div>
<p>Have fun with this.. hope it helps. There is literally a million ways you can do this. I would probably suck the RSS feed in directly via the worker script, then parse and insert that into the database if I was to do it again.</p>


<p>Related posts:<ol><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>
<li><a href='http://www.money-code.com/2009/07/including-twitter-updates-in-your-site/' rel='bookmark' title='Permanent Link: Including Twitter updates in your site'>Including Twitter updates in your site</a></li>
<li><a href='http://www.money-code.com/2007/09/capture-search-data-on-your-site/' rel='bookmark' title='Permanent Link: Capture search data on your site'>Capture search data on your site</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.money-code.com/2009/08/including-your-wordpress-blogs-to-a-external-website/feed/</wfw:commentRss>
		<slash:comments>2</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! -->