Money-Code

Coding For Online Success

June 7, 2009
by admin
0 comments

FTP’ing files from CJ’s FTP server to your host

I had a few people email me about my Parsing XML CJ Product Feeds 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 exec() function to execute the wget program on the server (assuming you have access and permissions to use wget via script).



Continue reading

June 2, 2009
by admin
19 Comments

Parsing XML CJ Product Feeds

I mentioned on May 29th 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.

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).

Continue reading

May 29, 2009
by admin
1 Comment

CJ now allows you to manage/create product catalogs!

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:

“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.”

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.

Continue reading

January 10, 2008
by admin
0 comments

Problems fetching CJ Product Feeds with PHP’s FTP functionality

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|off) as well as format (ASCII|BINARY) and the result was the same.

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.

Continue reading