You are here:  » Commission Junction Feeds

Commission Junction Feeds

Submitted by ccgale on Tue, 2013-11-26 12:40 in


Anyone know the best way to deal with CJ feeds please. I am download the feeds from the network to my server but they are being saved as .txt.gz files. PT seems unable to extract the contents of these files. I can do it manually and reupload but that hinders me trying to automate the process.


Submitted by support on Tue, 2013-11-26 12:59

Hello Carl,

It may be one of 3 things;

- CJ passwords can include special characters for example @ or & that must be encoded when provided as the username:password part of the URL. Use the following translations were necessary:

# encode as %23
$ encode as %24
% encode as %25
@ encode as %40

- Some FTP servers require PASV transfers which are handled better by the "curl" automation handler. If not already using curl, edit config.advanced.php and modify line 43 as follows:

  $config_automationHandler = "curl";

- Finally, it may be a .gz decompression issue. I have found recently that PHP's internal gzip functions work in some instances where shelling out to the gzip command doesn't so if neither of the above resolve the problem, if you modify includes/automation.php and locate the automation_unzip_gzip() function beginning at line 160 and REPLACE with the following alternative version:

  function automation_unzip_gzip($tmp)
    $gfp = gzopen($tmp,"r");
    if (!$gfp) return FALSE;
    $fp = fopen($tmp.".ungzipped","w");
    if (!$fp) return FALSE;
    while(!gzeof($gfp)) fwrite($fp,gzread($gfp,2048));
    return TRUE;

Hope this helps!


Submitted by ccgale on Tue, 2013-11-26 13:47


Thanks, the third option seems to have fixed the problem. Can automate the task now.