Skip to content


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.

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.

<?php
exec("wget -P/your/local/directory/ ftp://password:username@ datatransfer.cj.com/outgoing/productcatalog/catalognumber/*.*");
?>
 


Related posts:

  1. FTP’ing files from CJ’s FTP server to your host
  2. Parsing XML CJ Product Feeds
  3. CJ now allows you to manage/create product catalogs!
  4. GeoIP Scripts PHP and JavaScript
  5. Simple script for connecting to Commission Junction’s Product Web Service and populating a local database

Posted in Affiliate Marketing, Programming.

Tagged with , , , .


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.

Powered by WP Hashcash