Results 1 to 21 of 21
  1. #1
    ABW Veteran Mr. Sal's Avatar
    Join Date
    January 18th, 2005
    Posts
    6,795
    How to FTP and Import CJ datafeeds from the CJ Zip File...
    Preamble...

    Back on July 1st, 2005, Dirk Gardner created the now famous: "Building UNIQUE autoupdating bulletproof datafeed sites that sell" thread, and from that big by now thread, many people new to datafeeds may have learned a few things about general datafeeds, that they may not even knew before.

    Then, on March 6th, 2007, Shawn (mobilebadboy) decided to share his now famous step by step script of: "How to FTP and Import SAS datafeeds"

    Then recently on July 3rd, 2008 when SeymourButts opened this thread, asking: "Automated FTP of my Current SAS Database?". It didn't took too long before Donk on July 5th, 2008, made that great post #14, on were he posted the entire script, on: "How to Automatically Import The dealdatabase2.xml Into a Database"

    By now, we all should know more ways than one, of how to handle any of the datafeeds from SAS, even the coupons.xml feed.

    -------------------------------------

    I normally don't like to ask questions about PHP until I run out of options, but after over a week of searching for a better solution, today August 10th, 2008, I decided to ask here on ABW, and see what results this thread might output.

    How to FTP and Import CJ datafeeds, from the CJ Zip File?

    Anyone wants to share some PHP code, on how to deal with the CJ datafeeds?

    Getting the datafeeds on a .Zip file automatically by FTP is not a big deal, if you know the exact name of the .zip file, but since the CJ file includes the date on the file name like: xxxxx_xxxxx_Date-Of-File.zip, then it makes the automatically download more difficult if you don't know what date to use on the import script.

    On the Price Tapestry website, they have a page with: "Product Feed Download Automation Guide", explaining how to handle many datafeeds, including the CJ datafeeds. So I thought that if I ask here, that maybe someone would post a shorter version of code, just to handle the CJ .zip file.

    I know that some code of the Date Function must be used on the import script, but before I eventually figure out by myself later, I decided to ask here now, and maybe save some time and brain cells for later.

  2. #2
    Moderator
    Join Date
    April 6th, 2006
    Posts
    2,689
    You can ask CJ to use a consistent file name for your account, instead of a date-stamped version.

    That may solve some of your problem automating.. alternatively (and a little more work), I have used scripts that assign the "get" filename based on datestamp.

    Try asking CJ first, it shouldn't be a problem... I think I found that info here...

  3. #3
    Full Member
    Join Date
    October 22nd, 2006
    Posts
    200
    I've been attempting to extract the filename from the email that CJ sends out with the details.

    First set up an email account and instead of forwarding to another email a/c you can send it to a script:

    Code:
    |/usr/bin/php -q /home/my_domain/public_html/email.php
    The email.php puts the whole email in a database:

    PHP Code:
    <?php
    // read from stdin
    $fd fopen("php://stdin""r");
    $email "";
    while (!
    feof($fd)) {
        
    $email .= fread($fd1024);
    }
    fclose($fd);
    // handle email
    $lines explode("\n"$email);
    // empty vars
    $from "";
    $to="";
    $subject "";
    $headers "";
    $message "";
    $splittingheaders true;
    for (
    $i=0$i count($lines); $i++) {
        if (
    $splittingheaders) {
            
    // this is a header
            
    $headers .= $lines[$i]."\n";

            
    // look out for special headers
            
    if (preg_match("/^Subject: (.*)/"$lines[$i], $matches)) {
                
    $subject $matches[1];
            }
            if (
    preg_match("/^From: (.*)/"$lines[$i], $matches)) {
                
    $from $matches[1];
            }
            if (
    preg_match("/^To: (.*)/"$lines[$i], $matches)) {
                
    $to $matches[1];
            }
        } else {
            
    // not a header, but message
            
    $message .= $lines[$i]."\n";
        }

        if (
    trim($lines[$i])=="") {
            
    // empty line, header section has ended
            
    $splittingheaders false;
        }
    }
    $link=mysql_connect ("localhost""username""password");
    mysql_select_db ("database"); 
    $sql ="INSERT INTO email VALUES ('','$from','$to','$subject','$headers','$message')";
    $result=mysql_query($sql);
    ?>
    Now you can use regex expression to find the filename in the message field. You could also use the email as a trigger to start your download script.

    I have requested the http option rather than ftp. I automatically download the file using http:// user: password @ datatransfer .cj.com /filename.

    The price tapestry script is a shell script so I'm not sure if you can use use it for ftp feeds.

    Bob

    edit makes a smiley so i've added spaces : p
    Last edited by Donk; August 10th, 2008 at 04:55 PM.

  4. #4
    Full Member
    Join Date
    October 22nd, 2006
    Posts
    200
    Hi Mr Sal.

    I'm currently writing some scripts for CJ and I've come across a few issues that should be considered first before publishing here.

    1/ CJ allows various methods of delivery of the script. Should the script allow for all methods (ftp up/ftp down/http )to access the feeds or just assume the feeds have been already been downloaded to the server?

    2/ The downloaded file is in zip format can it be assumed that most users have zip enabled in their php?

    3/ As this is a follow on from the SAS import script. Should the script import the feed into a CJ style database table or be translated into a standard SAS table so that users can use the same script to display SAS and CJ feeds?


    Regards
    Bob

  5. #5
    ABW Veteran Mr. Sal's Avatar
    Join Date
    January 18th, 2005
    Posts
    6,795
    Quote Originally Posted by Donk
    Hi Mr Sal.

    I'm currently writing some scripts for CJ and I've come across a few issues that should be considered first before publishing here.

    1/ CJ allows various methods of delivery of the script. Should the script allow for all methods (ftp up/ftp down/http )to access the feeds or just assume the feeds have been already been downloaded to the server?

    2/ The downloaded file is in zip format can it be assumed that most users have zip enabled in their php?

    3/ As this is a follow on from the SAS import script. Should the script import the feed into a CJ style database table or be translated into a standard SAS table so that users can use the same script to display SAS and CJ feeds?


    Regards
    Bob
    Hi Bob,

    1) I know there're many different ways to get the CJ feeds, but since I am already used to get the feeds by FTP from other networks, I selected to get my CJ feeds by FTP too. Now every Saturday I know I have a fresh feed available.

    2) I get all my merchants feeds in just one zip format file, but I believe that there are other formats available.

    Getting the zip file automatically it's not a big deal, as long as the file name of the zip is always the same, but since CJ adds the date to the file name, then some code to handle an specific date must be included on the import script.

    If I tell my cron script to get the zip on the same date the zip is available, then it would be easy to do, because I can just add the $date to the file name, but if for whatever reason the Today-Date don't = $today, then the script don't get the file. I have tried different ways to make the date = any date without any luck jet, so I am just getting the zip manually first, and then do the rest automatically.

    3) If some people may want to have a table for CJ and SAS combined, I don't know!

    I like to keep my tables and databases from different networks separated, no network uses the same feed format anyway.

    Making a table for CJ, is about the same of making a table for SAS, only the Field names are different, so I don't think anyone would have any problem making a CJ table.

    Bob, thanks for bumping this thread again, but it looks like no one else is interested in this subject. (Yet!)

    Thank you.

  6. #6
    ABW Ambassador bettylou's Avatar
    Join Date
    December 27th, 2005
    Location
    Indiana
    Posts
    595
    Hi Mr. Sal,

    I haven't been around for a little while, I'm sorry for not responding sooner. I do just like you said about the date script. My CJ file updates on Tuesday nights so I run the updates for my database on Wednesday morning. I just find the current date and subtract one day from that. I store that value in a variable.

    $date = date('Ymd', strtotime('-1 day'));

    So that would give the $date variable the value of yesterday in the proper format.

    Then to unzip, I use this:

    $filename = "xxxxxxx_xxxx_$date.txt.gz";
    $zd = gzopen($filename, "r");
    gzseek($zd, $myrow["start"]);
    $file = gzread($zd, 100000);
    gzclose($zd);

    The entire unzip part looks like this:

    PHP Code:
    $date date('Ymd'strtotime('-1 day'));

    $filename "xxxxxxx_xxxx_$date.txt.gz";
    $zd gzopen($filename"r");
    gzseek($zd$myrow["start"]); 
    $file gzread($zd100000); 
    gzclose($zd); 

  7. #7
    Full Member
    Join Date
    October 22nd, 2006
    Posts
    200
    Hi Bettylou

    I have been looking at the cj feeds with zip compression rather than gz compression.

    Perhaps we should have agreed on a common delivery method before starting this thread.

    Mr Sal.

    Using the numbers from my previous post.

    1/ For now I will assume the file has been downloaded to a folder called feeds and renamed cj.zip

    2/ I will assume people have got / can get zip enabled in their php

    3/ Unless specifically requested I'll use the CJ format.

    Here is a DRAFT script that gets the feed into a database. As usual you must enter you database username etc. into the appropriate variables

    PHP Code:
    <?php
    $directory
    ="feeds/";
    $filename="cj.zip";
    $fieldseparator="|";
    $separatetables=false;
    $dbhost="localhost";
    $dbuser="";
    $dbpass="";
    $dbdbase="";
    $link mysql_connect("$dbhost""$dbuser""$dbpass");
     
    mysql_select_db("$dbdbase") ;
     
    $sql="CREATE TABLE IF NOT EXISTS `cjfeeds` (
    `PROGRAMNAME` varchar(100),
    `PROGRAMURL` varchar(300),
    `CATALOGNAME` varchar(130),
    `LASTUPDATED` varchar(100),
    `NAME` varchar(160),
    `KEYWORDS` varchar(300),
    `DESCRIPTION` varchar(3000),
    `SKU` varchar(100),
    `MANUFACTURER` varchar(160),
    `MANUFACTURERID` varchar(64),
    `UPC` varchar(100),
    `ISBN` varchar(64),
    `CURRENCY` varchar(3),
    `SALEPRICE` decimal(10,2),
    `PRICE` decimal(10,2),
    `RETAILPRICE` decimal(10,2),
    `FROMPRICE` varchar(3),
    `BUYURL` varchar(500),
    `IMPRESSIONURL` varchar(300),
    `IMAGEURL` varchar(300),
    `ADVERTISERCATEGORY` varchar(300),
    `THIRDPARTYID` varchar(64),
    `THIRDPARTYCATEGORY` varchar(300),
    `AUTHOR` varchar(130),
    `ARTIST` varchar(130),
    `TITLE` varchar(130),
    `PUBLISHER` varchar(130),
    `LABEL` varchar(130),
    `FORMAT` varchar(64),
    `SPECIAL` varchar(3),
    `GIFT` varchar(3),
    `PROMOTIONALTEXT` varchar(300),
    `STARTDATE` varchar(100),
    `ENDDATE` varchar(100),
    `OFFLINE` varchar(3),
    `ONLINE` varchar(3),
    `INSTOCK` varchar(3),
    `CONDITION` varchar(11),
    `WARRANTY` varchar(300),
    `STANDARDSHIPPINGCOST` decimal(10,2),
      PRIMARY KEY  (`SKU`)
    ) ENGINE=MyISAM;"
    ;
    mysql_query($sql)or die ("create cj table".mysql_error());
    if (
    realpath($directory."/".$filename)){
        if (
    $zip zip_open(realpath($directory."/".$filename)))
            {
                while ((
    $zip_entry zip_read($zip))){
                
    $zipfilename=zip_entry_name($zip_entry  );
                echo 
    $zipfilename."<br>";
                
    $tmpfname tempnam("/tmp""");
                
    $handle fopen($tmpfname"w+");
                while(
    $data zip_entry_read($zip_entry,4096)){
                
    fwrite($handle,$data);
                }
    // end while $data
                
    fseek($handle,0);
                if (
    $separatetables);
                
    $table=strtok($zipfilename,"-");
                
    $sql="CREATE TABLE IF NOT EXISTS `$table` LIKE `cjfeeds`";
                 
    mysql_query($sql);
                 
    $sql "TRUNCATE TABLE `$table`";
                
    mysql_query($sql);

                   
    // I'm not too sure if this is windows specific
                 
    $tmpfile=addslashes($tmpfname);
                            
    //if the script times out uncomment the next line 
                // ini_set("max_execution_time",500);
                
    $sql ="LOAD DATA LOCAL INFILE '$tmpfile' REPLACE  INTO TABLE `$table` FIELDS TERMINATED BY '$fieldseparator' IGNORE 1 LINES;";
                
    //echo $sql."<br>";
                
    mysql_query($sql)or die ("load data infile".mysql_error());
                
    fclose ($handle);
                
    unlink ($tmpfname);
                }
    // endwhile zip_entry
            
    zip_close($zip);
            }
    // if $zip    
    }//if realpath
    ?>
    This script does not include the "best practice" suggestions made by Michael Coley. Perhaps they should be considered before the script is taken too far.

    As far as I know this script will not work on Bigdaddy servers as (AFAIK) they do not allow LOAD DATA INFILE.

    I had to addslashes to the filename in the LOAD DATA INFILE but I don't know if that was because I was running the script under windows.

    Regards

    Bob

  8. #8
    ABW Veteran Mr. Sal's Avatar
    Join Date
    January 18th, 2005
    Posts
    6,795
    Quote Originally Posted by bettylou
    Hi Mr. Sal,
    I do just like you said about the date script. My CJ file updates on Tuesday nights so I run the updates for my database on Wednesday morning. I just find the current date and subtract one day from that. I store that value in a variable.

    $date = date('Ymd', strtotime('-1 day'));

    So that would give the $date variable the value of yesterday in the proper format.

    Then to unzip, I use this:

    PHP Code:
    $date date('Ymd'strtotime('-1 day'));
     
    $filename "xxxxxxx_xxxx_$date.txt.gz";
    $zd gzopen($filename"r");
    gzseek($zd$myrow["start"]); 
    $file gzread($zd100000); 
    gzclose($zd); 
    Hi Bettylou,

    Yes, I have used something like that code before: $date = date('Ymd');

    But with doing it that way, the script still has to be touched every week just to change the date again.

    This morning I finally found a way to get the zip file, regardless of what date the zip have on it:

    ---------------------------------
    $filename = "*.zip";
    exec("/path to/unzip $filename");
    ---------------------------------

    and then I was able to extract the files, and rename the files automatically.

    With that code, as long as there are no other .zip file on that directory, everything will work fine and automatic for me, but..........

    Now the problem would be on how to delete that used .zip file automatically, after I got all my files ready for action, becuse if I leave that now old zip on the directory, then my code won't work the next time.

    I tried to delete or unlink that $filename, but then I will get the error of that file doesn't exist, and if I do this:

    echo "$filename";

    Then it will print: *.zip

    Something sounds weird there, because if the script can use that *.zip to unzip the only zip file on that directory, then I don't see a reason why it can't also delete the same *.zip file when it finish with it.

    But still, even if the script can't delete the *.zip file, at least for now I don't have to worry about any date on the zip file, and I don't have to touch that script every week to change the date...

    I just have to manually delete the zip file from the server, but now I have seven days to do that, and I don't have to worry about any of the date on the file.

    But, I will keep on searching, researching, and experimenting, because sooner or later I will find a better way, I always do.

    Thanks for posting your code Bettylou, I am sure it will help others stuck with the .txt.gz file too.

  9. #9
    Moderator
    Join Date
    April 6th, 2006
    Posts
    2,689
    I might be missing something as this thread has progressed - but you can ask CJ to deliver a zip file under a static name. I had issues with automating the download myself, and this solved the problem.

    Sorry if I have jumped in here unnecessarily , but I thought part of the original problem was handling the variable zip file name. You can eliminate that at the source (ie. CJ).

  10. #10
    ABW Veteran Mr. Sal's Avatar
    Join Date
    January 18th, 2005
    Posts
    6,795
    Quote Originally Posted by Donk
    Hi Bettylou

    I have been looking at the cj feeds with zip compression rather than gz compression.

    Perhaps we should have agreed on a common delivery method before starting this thread.

    Mr Sal.

    Using the numbers from my previous post.

    1/ For now I will assume the file has been downloaded to a folder called feeds and renamed cj.zip

    2/ I will assume people have got / can get zip enabled in their php

    3/ Unless specifically requested I'll use the CJ format.

    Here is a DRAFT script that gets the feed into a database. As usual you must enter you database username etc. into the appropriate variables
    Bob,


    I don't think there is a big difference in getting the cj feeds with zip, or gz compression, because those two format should be open in a similar fashion with no problem.

    I think that what Bettylou and I are looking for, it's for a better way to deal with the different date on the feed file, and I would like to think that a solution for either one of those two format, can be used on the other the same way.

    As for the script code to that gets the feed into a database, I don't think that anyone that uses the SAS script will have any problem just changing the Field names and the $sourcefile address on their SAS script to make a new CJ script.

    That's what I did, and I have my CJ products showing just like the SAS products would.





    Yes, I know that CJ and SAS have no products, their merchants are the one's that have the products, so no one try to be funny about the way I write somethimes.

  11. #11
    ABW Veteran Mr. Sal's Avatar
    Join Date
    January 18th, 2005
    Posts
    6,795
    Quote Originally Posted by teezone
    I might be missing something as this thread has progressed - but you can ask CJ to deliver a zip file under a static name. I had issues with automating the download myself, and this solved the problem.

    Sorry if I have jumped in here unnecessarily , but I thought part of the original problem was handling the variable zip file name. You can eliminate that at the source (ie. CJ).
    Hi teezone,

    Yes, I agree that asking CJ for a zip file under a static name will solve this problem, and I appreciate and thank you for that solution, I probably would be asking CJ for an static name for my zip file by next week too.

    I really want to thank you for the suggestion, of asking CJ for a zip file under a static name, because before I opened this thread, I had no idea that CJ would do that for us.

    But, now that I have got myself on this new PHP challenge on my learning curve, I will still try to find a way to learn how to mess with that changing date issue, even if now (thanks to you), I can get CJ to deliver an static file.





    I think I most still have some of my old electronics technician blood left on me, because I always want to know how things work, or why they don't work.

  12. #12
    Moderator
    Join Date
    April 6th, 2006
    Posts
    2,689
    I have got myself on this new PHP challenge
    I totally agree that being able to solve it on your own is a real plus.. the programming skills are more valuable in the long run!

    I had spent some time on this myself when I stumbled across the "ask CJ" solution, and it worked for me. They created a 2nd account (which changed the default directory for the 'get'), and it went very smoothly.

    Good luck with the php side of things, sounds like you will have more control over your own environment when this is done

  13. #13
    Member
    Join Date
    January 18th, 2005
    Location
    Finger Lakes, NY
    Posts
    61
    This is a great thread, it's really kind of people to share their code here for a relatively difficult feed grab. Thanks everyone.

  14. #14
    ABW Ambassador Nature Boy's Avatar
    Join Date
    January 18th, 2005
    Location
    Tennessee
    Posts
    1,423
    Unhappy
    I'm tired of beating my head against the wall and think it's time to ask for some help... and sorry for dragging up an old thread, but this is the closest I could find that even gave me any ideas. (BTW, it would be nice if the board allowed searching of 2 letter words, ie: "unzip gz files")

    I'm trying my best to use the script mobilebadboy furnished to work with CJ's feeds that end with .txt.gz, but for the life of me, I can't automate the unzipping of the *.gz files on my server.

    Any suggestions? I've tried gunzip, but nothing appears to happen when I run that command via my php script.
    Scott
    If you can't dazzle them with brilliance, then baffle them with bulls#!t
    Don't tell me that you'll do it... SHOW ME.
    Just because everyone else is drinking it is no reason for me to drink the KOOL-AID.

  15. #15
    ABW Veteran Mr. Sal's Avatar
    Join Date
    January 18th, 2005
    Posts
    6,795
    Quote Originally Posted by Nature Boy
    I'm trying my best to use the script mobilebadboy furnished to work with CJ's feeds that end with .txt.gz, but for the life of me, I can't automate the unzipping of the *.gz files on my server.

    Any suggestions? I've tried gunzip, but nothing appears to happen when I run that command via my php script.
    Hi Scott,

    I was waiting a few more days before I tried to unzip those new .txt.gz on the server but when I saw your post I decided to try it now...

    for the last few days since CJ made the new datafeeds feature available, I was just downloading those .txt.gz to my HD and then uploading some feeds to the server after I unziped them on my HD first, but since IOU one, I decided to test if I was able to unzip it on the server now...

    Well, by checking the Dirk Gardner PHP Code here: http://forum.abestweb.com/showpost.p...8&postcount=11 , I was able to unzip one .txt.gz on the server with no problem, this is what I used to do the unzip:

    $FeedFile = 'MerchantFile.txt.gz';

    mysql_query("drop table $temptable");
    mysql_query("CREATE TABLE $temptable (
    ...
    ...
    ...
    ...
    StandardShippingCost VARCHAR(7) NOT NULL default '')") or die(mysql_error());

    $feed = gzopen($FeedFile, 'r');

    $rowNum = 0;
    $recCount = 0;

    while($data = fgetcsv($feed, 3000, "\t")){
    if($rowNum > 0){
    $Merchant = trim(addslashes($data[0]));
    I uploaded the MerchantFile.txt.gz file to the server first, because I already had it on my HD, but you should not have any problem by calling the file from the CJ server or if they send you the file to your server...

    I can't automate the unzipping of the *.gz files on my server.
    Now, the part about doing the automate the unzipping of the *.gz files, that's the job of the cron job.

  16. #16
    ABW Ambassador Nature Boy's Avatar
    Join Date
    January 18th, 2005
    Location
    Tennessee
    Posts
    1,423
    Thanks Sal.

    I tried that and got nothing. I contacted my host, Hostgator, and found out they DO NOT support gzopen for their reseller accounts, just their dedicated servers. That at least explains me spinning my wheels for the past 3 days with this problem

    Any other ideas on how to open a gz file on a server?

    It would be nice if CJ offered the option to have those files as *.zip files, I can make those work all day long.
    Scott
    If you can't dazzle them with brilliance, then baffle them with bulls#!t
    Don't tell me that you'll do it... SHOW ME.
    Just because everyone else is drinking it is no reason for me to drink the KOOL-AID.

  17. #17
    ABW Veteran Mr. Sal's Avatar
    Join Date
    January 18th, 2005
    Posts
    6,795
    Any other ideas on how to open a gz file on a server?
    That was the only way I have learned to open those files, but I don't know if there is another way to do it.

    I tried searching on Google and I don't now if this is any good, but it looks like maybe it works?
    Compression Streams

    compress.zlib:// and compress.bzip2:// are equivalent to gzopen() and bzopen() respectively, and operate even on systems that do not support fopencookie.
    Source: http://www.php.net/manual/en/wrappers.compression.php
    Other then that, I don't know...

    If your host don't support gzopen on your account, and CJ don't have the option you want, maybe you can try sending those .txt.gz files to another server that have gzopen available and then get your unziped files from there with a cron job.

    I know is extra work but once done that way, you may set it and forget it...

    For example: Get any cheap new domain name regardless of the extension, and then get any of those less than $4.00 hosting account out there, and just use that account as your third party datafeed solution, but just make sure they allow gzopen first...

    Maybe that idea sound a little bit crazy, but it sure beats opening the files on the HD first, or havin to switch your entire Hostgator account to another host...

    Btw, I am surprised that no one else have posted any other solution or ideas here, so far...

  18. #18
    Comfortably Numb John Powell's Avatar
    Join Date
    October 17th, 2005
    Location
    Bayou Country, LA
    Posts
    3,432
    I use
    $download = ftp_get($conn_id, $destination_file, $source_file, FTP_BINARY);
    Note the FTP_BINARY. After that since it's XML I use
    simplexml_load_string($feed_file);
    to do the work.

    I don't need to use gzopen() but my server does support gz. If this seems close to anything you can use I can give more details.

    I created a Class while back that covers AvantLink, CJ, SAS, and GAN and use it on all my feed related sites but those are the main ingredients for the CJ part.


  19. #19
    Full Member iolaire's Avatar
    Join Date
    October 3rd, 2006
    Location
    Arlington, VA
    Posts
    229
    Quote Originally Posted by Nature Boy
    Any other ideas on how to open a gz file on a server?
    Can you run system level commands? For example in a ruby script I would run the following to unzip gz the files:
    Code:
    t = system("/opt/local/bin/unzip  -u /temp/file_name.txt.gz -d /temp/")
    where system() is the ruby command to run a command line step, it will use the Apache user rights so temp needs to be read/write by Apache.

    I would think that using hostgator you could automate the unzipping, if you do a Google search you will find that their CPannel tools allow it - so more than likely your scripts can. gzopen is a ?PHP? command that is not supported, so think more system level connections from ?PHP?.

    Added - this is what I'm talking about in PHP:
    http://www.hawkee.com/snippet/2809/

  20. #20
    ABW Ambassador Nature Boy's Avatar
    Join Date
    January 18th, 2005
    Location
    Tennessee
    Posts
    1,423
    Thumbs up
    I just got done talking with someone else at Hostgator's support and he suggested using this:

    exec("gunzip MERCHANT.txt.gz");

    And...
    It works

    What is bad, is that I couldn't use unzip when I origianlly setup my script to pull from SAS and had this line of code to open *.zip files from SAS:

    exec("unzip -o MERCHANT.zip");

    Sometimes, it's something so simple...

    Thanks for the help folks
    Scott
    If you can't dazzle them with brilliance, then baffle them with bulls#!t
    Don't tell me that you'll do it... SHOW ME.
    Just because everyone else is drinking it is no reason for me to drink the KOOL-AID.

  21. #21
    ABW Veteran Mr. Sal's Avatar
    Join Date
    January 18th, 2005
    Posts
    6,795
    Quote Originally Posted by Nature Boy
    I just got done talking with someone else at Hostgator's support and he suggested using this:

    exec("gunzip MERCHANT.txt.gz");

    And...
    It works
    I'm glad you got it to work!

    What is bad, is that I couldn't use unzip when I origianlly setup my script to pull from SAS and had this line of code to open *.zip files from SAS:

    exec("unzip -o MERCHANT.zip");

    Sometimes, it's something so simple...

    Thanks for the help folks
    It's true, sometimes it is just a small line of code with the right formula on it, what can make the big difference in time and productivity...

    I think I have used something like that exec("unzip -o MERCHANT.zip"); a few years ago when I was testing some MERCHANT.zip files, but since I read that some hosting companies don't allow the exec(" command to run on their server, I didn't tried to play around much with the exec(" command just in case...

    The good thing is that we all can learn something new everyday, so I know that this thread may help someone new to this code, in the future...

  22. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. How to FTP and Import SAS datafeeds
    By mobilebadboy in forum Programming / Datafeeds / Tools
    Replies: 180
    Last Post: August 21st, 2011, 03:34 AM
  2. SAS/FTP Datafeed Import Script
    By mobilebadboy in forum Programming / Datafeeds / Tools
    Replies: 36
    Last Post: March 7th, 2009, 08:33 PM
  3. Read Zip File
    By Uncle Rico in forum Programming / Datafeeds / Tools
    Replies: 6
    Last Post: February 9th, 2008, 05:04 PM
  4. zip file datafeed file transfer into database
    By rahulcbr in forum Programming / Datafeeds / Tools
    Replies: 13
    Last Post: August 28th, 2007, 04:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •