<?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; error</title>
	<atom:link href="http://www.money-code.com/tag/error/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.money-code.com</link>
	<description>Coding For Online Success</description>
	<lastBuildDate>Tue, 15 Nov 2011 18:25:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>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 [...]


Related posts:<ol><li><a href='http://www.money-code.com/2009/10/simple-modification-to-fd-feedburner-plugin/' rel='bookmark' title='Simple modification to FD Feedburner Plugin'>Simple modification to FD Feedburner Plugin</a></li>
<li><a href='http://www.money-code.com/2009/06/good-adjustments-made-to-my-new-wordpress-blog/' rel='bookmark' title='Good adjustments made to my new WordPress blog'>Good adjustments made to my new WordPress blog</a></li>
<li><a href='http://www.money-code.com/2009/10/update-wordpress/' rel='bookmark' title='Update WordPress!'>Update WordPress!</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"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2010%2F01%2Fissues-with-cjniche-wordpress-plugin%2F&amp;source=hanjicode&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</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>
<h4>Incoming search terms:</h4><ul><li>cjniche</li><li>cjniche wordpress plugin</li><li>cjniche plugin</li><li>wordpress plugin cjniche</li><li>cjniche review</li><li>/plugins/cjniche/cjniche php on line 22</li><li>wordpress commision junction plugin warning wp-content/plugins/cjniche/cjniche php on line 22</li><li>what happened to cjniche</li><li>warning: invalid argument supplied for foreach() cjniche</li><li>how cjniche works</li></ul><div style='clear:both'></div>

<p>Related posts:<ol><li><a href='http://www.money-code.com/2009/10/simple-modification-to-fd-feedburner-plugin/' rel='bookmark' title='Simple modification to FD Feedburner Plugin'>Simple modification to FD Feedburner Plugin</a></li>
<li><a href='http://www.money-code.com/2009/06/good-adjustments-made-to-my-new-wordpress-blog/' rel='bookmark' title='Good adjustments made to my new WordPress blog'>Good adjustments made to my new WordPress blog</a></li>
<li><a href='http://www.money-code.com/2009/10/update-wordpress/' rel='bookmark' title='Update WordPress!'>Update WordPress!</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>7</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! -->
