Money-Code

Coding For Online Success

Problems fetching CJ Product Feeds with PHP’s FTP functionality

| 0 comments

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.

As I stated above all FTP clients were able to fetch the file, so I thought I’d try wget, and sure enough that works. I can simply call wget in my local fetch script to get it.

Here is a snippet in case anyone needs to know how to fetch CJ data feeds with wget.

span class=”st0″>"wget -P/your/local/directory/ ftp://password:username@ datatransfer.cj.com/outgoing/productcatalog/catalognumber/*.*"

Leave a Reply

Required fields are marked *.


CommentLuv badge

This site uses Akismet to reduce spam. Learn how your comment data is processed.