<?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; datafeed</title>
	<atom:link href="http://www.money-code.com/tag/datafeed/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>FTP&#8217;ing files from CJ&#8217;s FTP server to your host</title>
		<link>http://www.money-code.com/2009/06/ftping-files-from-cjs-ftp-server-to-your-host/</link>
		<comments>http://www.money-code.com/2009/06/ftping-files-from-cjs-ftp-server-to-your-host/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 01:59:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[cj]]></category>
		<category><![CDATA[datafeed]]></category>
		<category><![CDATA[php]]></category>

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


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

<p>Related posts:<ol><li><a href='http://www.money-code.com/2008/01/problems-fetching-cj-product-feeds-with-phps-ftp-functionality/' rel='bookmark' title='Problems fetching CJ Product Feeds with PHP&#8217;s FTP functionality'>Problems fetching CJ Product Feeds with PHP&#8217;s FTP functionality</a></li>
<li><a href='http://www.money-code.com/2009/06/geoip-scripts-php-and-javascript/' rel='bookmark' title='GeoIP Scripts PHP and JavaScript'>GeoIP Scripts PHP and JavaScript</a></li>
<li><a href='http://www.money-code.com/2007/10/cj-quick-stat-email-script/' rel='bookmark' title='CJ Quick Stat Email Script'>CJ Quick Stat Email Script</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.money-code.com/2009/06/ftping-files-from-cjs-ftp-server-to-your-host/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Parsing XML CJ Product Feeds</title>
		<link>http://www.money-code.com/2009/06/parsing-xml-cj-product-feeds/</link>
		<comments>http://www.money-code.com/2009/06/parsing-xml-cj-product-feeds/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 02:32:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[cj]]></category>
		<category><![CDATA[datafeed]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[<p>I mentioned on <a href="http://www.money-code.com/node/115">May 29th</a> that CJ allows you to create and manage product catalogs now. This is great. You can create a product feed and have it available in your FTP directory (or whatever delivery method you wish). For my personal set up, I have it stored on their server, and I need to FTP to it and grab it. I do everything via PHP on a scheduled intervals.</p>

<p>I wanted to show you how you can grab the XML data and parse it. You could use it directly or push it into a database, etc. In my situation, I want to update a local database with product items. Items will be updated every week. I won't go into the database piece (let me know if you need me to go into INSERT/DELETE SQL examples).</p>


Related posts:<ol><li><a href='http://www.money-code.com/2008/01/problems-fetching-cj-product-feeds-with-phps-ftp-functionality/' rel='bookmark' title='Problems fetching CJ Product Feeds with PHP&#8217;s FTP functionality'>Problems fetching CJ Product Feeds with PHP&#8217;s FTP functionality</a></li>
<li><a href='http://www.money-code.com/2008/10/dynamic-xmlrss-feed-using-popshops/' rel='bookmark' title='Dynamic XML/RSS Feed using PopShops'>Dynamic XML/RSS Feed using PopShops</a></li>
<li><a href='http://www.money-code.com/2007/09/simple-script-for-connecting-to-commission-junctions-product-web-service-and-populating-a-local-database/' rel='bookmark' title='Simple script for connecting to Commission Junction&#8217;s Product Web Service and populating a local database'>Simple script for connecting to Commission Junction&#8217;s Product Web Service and populating a local database</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.money-code.com%2F2009%2F06%2Fparsing-xml-cj-product-feeds%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2009%2F06%2Fparsing-xml-cj-product-feeds%2F&amp;source=hanjicode&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I mentioned on <a href="http://www.money-code.com/node/115">May 29th</a> that CJ allows you to create and manage product catalogs now. This is great. You can create a product feed and have it available in your FTP directory (or whatever delivery method you wish). For my personal set up, I have it stored on their server, and I need to FTP to it and grab it. I do everything via PHP on a scheduled intervals.</p>
<p>I wanted to show you how you can grab the XML data and parse it. You could use it directly or push it into a database, etc. In my situation, I want to update a local database with product items. Items will be updated every week. I won&#8217;t go into the database piece (let me know if you need me to go into INSERT/DELETE SQL examples).</p>
<p>For this example, you will need PHP5 since we&#8217;ll be using the <a rel="nofollow" href="http://us.php.net/manual/en/function.simplexml-load-file.php" target="_blank">simplexml_load_file()</a> function. This is assuming that you&#8217;ve already FTP&#8217;d the XML to your working directory. Again, let me know if you need this process as well, and I can provide some examples.</p>
<p>Once we have the XML file, we pass it to the simplexml_load_file function. This function quickly parses the XML into a object. Since it&#8217;s a object, it&#8217;s snap to reference the values. My example loops through the XML object and sets local variables with the values from the XML file. You could then INSERT this values into a database or display them in real time.</p>
<div class="dean_ch" style="white-space: wrap;">
<span class="kw2">&lt;?php</span><br />
<span class="re0">$xml</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&#8217;1111111_11111_20090528.xml&#8217;</span>;<br />
<span class="re0">$resp</span>&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = simplexml_load_file<span class="br0">&#40;</span><span class="re0">$xml</span><span class="br0">&#41;</span>;<br />
<span class="kw1">foreach</span><span class="br0">&#40;</span><span class="re0">$resp</span>-&gt;<span class="me1">product</span> <span class="kw1">as</span> <span class="re0">$item</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$name</span>&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="re0">$item</span>-&gt;<span class="me1">name</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$catalogname</span>&nbsp; &nbsp; = <span class="re0">$item</span>-&gt;<span class="me1">catalogname</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$lastupdated</span>&nbsp; &nbsp; = <span class="re0">$item</span>-&gt;<span class="me1">lastupdated</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$programurl</span>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; = <span class="re0">$item</span>-&gt;<span class="me1">programurl</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$keywords</span>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; = <span class="re0">$item</span>-&gt;<span class="me1">keywords</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$description</span>&nbsp; &nbsp; = <span class="re0">$item</span>-&gt;<span class="me1">description</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$sku</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="re0">$item</span>-&gt;<span class="me1">sku</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$manufacturer</span>&nbsp; &nbsp;= <span class="re0">$item</span>-&gt;<span class="me1">manufacturer</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$manufacturerid</span>&nbsp;= <span class="re0">$item</span>-&gt;<span class="me1">manufacturerid</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$upc</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="re0">$item</span>-&gt;<span class="me1">upc</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$currency</span>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; = <span class="re0">$item</span>-&gt;<span class="me1">currency</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$saleprice</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="re0">$item</span>-&gt;<span class="me1">saleprice</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$price</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="re0">$item</span>-&gt;<span class="me1">price</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$retailprice</span>&nbsp; &nbsp; = <span class="re0">$item</span>-&gt;<span class="me1">retailprice</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$buyurl</span>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="re0">$item</span>-&gt;<span class="me1">buyurl</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$impressionurl</span>&nbsp; = <span class="re0">$item</span>-&gt;<span class="me1">impressionurl</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$imageurl</span>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; = <span class="re0">$item</span>-&gt;<span class="me1">imageurl</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$advertisercategory</span>&nbsp; &nbsp; &nbsp;= <span class="re0">$item</span>-&gt;<span class="me1">advertisercategory</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$instock</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="re0">$item</span>-&gt;<span class="me1">instock</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$condition</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="re0">$item</span>-&gt;<span class="me1">condition</span>;<br />
<span class="br0">&#125;</span><br />
<span class="kw2">?&gt;</span><br />
&nbsp;</div>
<p>My version of MySQL is 5, if you&#8217;re running 5.1 or 6, you can use a sweet MySQL command called &#8220;LOAD XML LOCAL INFILE&#8221;. For example, you could run this and it would populate your database table very quickly.</p>
<div class="dean_ch" style="white-space: wrap;">
<span class="kw2">&lt;?php</span><br />
<span class="re0">$sql</span> = <span class="st0">&quot;LOAD XML LOCAL INFILE &#8217;1111111_11111_20090528.xml&#8217;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; INTO TABLE tblProductsTest<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ROWS IDENTIFIED BY &#8216; &#8216;&quot;</span>;<br />
<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">$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/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;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &quot;</span>.<span class="re0">$sql</span>;<br />
<span class="br0">&#125;</span><br />
<span class="kw2">?&gt;</span><br />
&nbsp;</div>
<p>I think the ability to quickly make some product feeds is awesome. Now, I just need to find time to create some new store fronts and make some cash. If you find this post useful, please follow me on <a rel="nofollow" href="https://twitter.com/hanjicode" target="_blank">Twitter</a> and Digg this post!</p>
<h4>Incoming search terms:</h4><ul><li>cj xml feed</li><li>cj rss feed</li><li>cj product feed directory ftp</li><li>parse commission junction xml php</li><li>php mysql script xml cj com</li><li>php cj get products by category</li><li>parsing cj product catalogs</li><li>parse xml to sql database php script</li><li>how to parse cj feeds</li><li>how to insert xml into sql</li></ul><div style='clear:both'></div>

<p>Related posts:<ol><li><a href='http://www.money-code.com/2008/01/problems-fetching-cj-product-feeds-with-phps-ftp-functionality/' rel='bookmark' title='Problems fetching CJ Product Feeds with PHP&#8217;s FTP functionality'>Problems fetching CJ Product Feeds with PHP&#8217;s FTP functionality</a></li>
<li><a href='http://www.money-code.com/2008/10/dynamic-xmlrss-feed-using-popshops/' rel='bookmark' title='Dynamic XML/RSS Feed using PopShops'>Dynamic XML/RSS Feed using PopShops</a></li>
<li><a href='http://www.money-code.com/2007/09/simple-script-for-connecting-to-commission-junctions-product-web-service-and-populating-a-local-database/' rel='bookmark' title='Simple script for connecting to Commission Junction&#8217;s Product Web Service and populating a local database'>Simple script for connecting to Commission Junction&#8217;s Product Web Service and populating a local database</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.money-code.com/2009/06/parsing-xml-cj-product-feeds/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>CJ now allows you to manage/create product catalogs!</title>
		<link>http://www.money-code.com/2009/05/cj-now-allows-you-to-managecreate-product-catalogs/</link>
		<comments>http://www.money-code.com/2009/05/cj-now-allows-you-to-managecreate-product-catalogs/#comments</comments>
		<pubDate>Fri, 29 May 2009 18:25:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Affiliate Marketing]]></category>
		<category><![CDATA[cj]]></category>
		<category><![CDATA[datafeed]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[<p>CJ now allows you to manage/create product catalogs data feeds! This is great to be able to generate new product feeds for FTP downloads. I'm not sure if their policy for the one time $200 product feed is still there or not. Here is the announcement from CJ:</p>

<blockquote>"Product Catalog Feeds are now Self Serve, which means you can add, delete or edit your catalog data feeds through the account manager. Please read our FAQ."</blockquote>

<p>In the next few days/weeks, I'll put together a little parser script to add/update a database table. I have this in place in a few sites, but I'll review and update the code and post it when it's ready.</p>


Related posts:<ol><li><a href='http://www.money-code.com/2008/01/problems-fetching-cj-product-feeds-with-phps-ftp-functionality/' rel='bookmark' title='Problems fetching CJ Product Feeds with PHP&#8217;s FTP functionality'>Problems fetching CJ Product Feeds with PHP&#8217;s FTP functionality</a></li>
<li><a href='http://www.money-code.com/2009/06/parsing-xml-cj-product-feeds/' rel='bookmark' title='Parsing XML CJ Product Feeds'>Parsing XML CJ Product Feeds</a></li>
<li><a href='http://www.money-code.com/2007/09/simple-script-for-connecting-to-commission-junctions-product-web-service-and-populating-a-local-database/' rel='bookmark' title='Simple script for connecting to Commission Junction&#8217;s Product Web Service and populating a local database'>Simple script for connecting to Commission Junction&#8217;s Product Web Service and populating a local database</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.money-code.com%2F2009%2F05%2Fcj-now-allows-you-to-managecreate-product-catalogs%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2009%2F05%2Fcj-now-allows-you-to-managecreate-product-catalogs%2F&amp;source=hanjicode&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>CJ now allows you to manage/create product catalogs data feeds! This is great to be able to generate new product feeds for FTP downloads. I&#8217;m not sure if their policy for the one time $200 product feed is still there or not. Here is the announcement from CJ:</p>
<blockquote><p>&#8220;Product Catalog Feeds are now Self Serve, which means you can add, delete or edit your catalog data feeds through the account manager. Please read our FAQ.&#8221;</p></blockquote>
<p>In the next few days/weeks, I&#8217;ll put together a little parser script to add/update a database table. I have this in place in a few sites, but I&#8217;ll review and update the code and post it when it&#8217;s ready.</p>
<h4>Incoming search terms:</h4><ul><li>create widget from cj product feed</li></ul><div style='clear:both'></div>

<p>Related posts:<ol><li><a href='http://www.money-code.com/2008/01/problems-fetching-cj-product-feeds-with-phps-ftp-functionality/' rel='bookmark' title='Problems fetching CJ Product Feeds with PHP&#8217;s FTP functionality'>Problems fetching CJ Product Feeds with PHP&#8217;s FTP functionality</a></li>
<li><a href='http://www.money-code.com/2009/06/parsing-xml-cj-product-feeds/' rel='bookmark' title='Parsing XML CJ Product Feeds'>Parsing XML CJ Product Feeds</a></li>
<li><a href='http://www.money-code.com/2007/09/simple-script-for-connecting-to-commission-junctions-product-web-service-and-populating-a-local-database/' rel='bookmark' title='Simple script for connecting to Commission Junction&#8217;s Product Web Service and populating a local database'>Simple script for connecting to Commission Junction&#8217;s Product Web Service and populating a local database</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.money-code.com/2009/05/cj-now-allows-you-to-managecreate-product-catalogs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Problems fetching CJ Product Feeds with PHP&#8217;s FTP functionality</title>
		<link>http://www.money-code.com/2008/01/problems-fetching-cj-product-feeds-with-phps-ftp-functionality/</link>
		<comments>http://www.money-code.com/2008/01/problems-fetching-cj-product-feeds-with-phps-ftp-functionality/#comments</comments>
		<pubDate>Thu, 10 Jan 2008 16:38:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Affiliate Marketing]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[cj]]></category>
		<category><![CDATA[datafeed]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[<p>I've been playing CJ product feeds (xml format), and came across a strange problem accessing the feed programatically using PHP's built FTP (--enable-ftp) functionality. FTPing to the site with any FTP client, even with command line FTP was no problem, but as soon as went from script the application would hang on the ftp_get() call. My firewall logs were showing lost return connections, so it almost seemed that they're rejecting traffic. I played with passive (on&#124;off) as well as format (ASCII&#124;BINARY) and the result was the same.</p>

<p>Doing a little googling I found other CJ users having the same problem with PHP and CJ Data Feeds. I think there is a FTP client flag that indicates that it's PHP and they're blocking it for security reasons. Probably to aide in stopping script spawned FTP brute force attacks?? Not sure. So, that still leaves me with a problem.. I'm unable to download the feeds with my script, but luckily there is always a million ways to skin an internet cat.</p>


Related posts:<ol><li><a href='http://www.money-code.com/2009/06/ftping-files-from-cjs-ftp-server-to-your-host/' rel='bookmark' title='FTP&#8217;ing files from CJ&#8217;s FTP server to your host'>FTP&#8217;ing files from CJ&#8217;s FTP server to your host</a></li>
<li><a href='http://www.money-code.com/2009/06/parsing-xml-cj-product-feeds/' rel='bookmark' title='Parsing XML CJ Product Feeds'>Parsing XML CJ Product Feeds</a></li>
<li><a href='http://www.money-code.com/2009/05/cj-now-allows-you-to-managecreate-product-catalogs/' rel='bookmark' title='CJ now allows you to manage/create product catalogs!'>CJ now allows you to manage/create product catalogs!</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.money-code.com%2F2008%2F01%2Fproblems-fetching-cj-product-feeds-with-phps-ftp-functionality%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2008%2F01%2Fproblems-fetching-cj-product-feeds-with-phps-ftp-functionality%2F&amp;source=hanjicode&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I&#8217;ve been playing CJ product feeds (xml format), and came across a strange problem accessing the feed programatically using PHP&#8217;s built FTP (&#8211;enable-ftp) functionality. FTPing to the site with any FTP client, even with command line FTP was no problem, but as soon as went from script the application would hang on the ftp_get() call. My firewall logs were showing lost return connections, so it almost seemed that they&#8217;re rejecting traffic. I played with passive (on|off) as well as format (ASCII|BINARY) and the result was the same.</p>
<p>Doing a little googling I found other CJ users having the same problem with PHP and CJ Data Feeds. I think there is a FTP client flag that indicates that it&#8217;s PHP and they&#8217;re blocking it for security reasons. Probably to aide in stopping script spawned FTP brute force attacks?? Not sure. So, that still leaves me with a problem.. I&#8217;m unable to download the feeds with my script, but luckily there is always a million ways to skin an internet cat.</p>
<p>As I stated above all FTP clients were able to fetch the file, so I thought I&#8217;d try wget, and sure enough that works. I can simply call wget in my local fetch script to get it.</p>
<p>Here is a snippet in case anyone needs to know how to fetch CJ data feeds with wget.</p>
<div class="dean_ch" style="white-space: wrap;">
<span class="kw2">&lt;?php</span><br />
<a href="http://www.php.net/exec"><span class="kw3">exec</span></a><span class="br0">&#40;</span><span class="st0">&quot;wget -P/your/local/directory/ ftp://password:username@ datatransfer.cj.com/outgoing/productcatalog/catalognumber/*.*&quot;</span><span class="br0">&#41;</span>;<br />
<span class="kw2">?&gt;</span><br />
&nbsp;</div>
<h4>Incoming search terms:</h4><ul><li>cj ftp download feeds</li><li>cj xml feed in php</li><li>download cj com feed using php</li><li>download feed from cj com using wget</li></ul><div style='clear:both'></div>

<p>Related posts:<ol><li><a href='http://www.money-code.com/2009/06/ftping-files-from-cjs-ftp-server-to-your-host/' rel='bookmark' title='FTP&#8217;ing files from CJ&#8217;s FTP server to your host'>FTP&#8217;ing files from CJ&#8217;s FTP server to your host</a></li>
<li><a href='http://www.money-code.com/2009/06/parsing-xml-cj-product-feeds/' rel='bookmark' title='Parsing XML CJ Product Feeds'>Parsing XML CJ Product Feeds</a></li>
<li><a href='http://www.money-code.com/2009/05/cj-now-allows-you-to-managecreate-product-catalogs/' rel='bookmark' title='CJ now allows you to manage/create product catalogs!'>CJ now allows you to manage/create product catalogs!</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.money-code.com/2008/01/problems-fetching-cj-product-feeds-with-phps-ftp-functionality/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
