iceblox Posted March 12, 2009 Share Posted March 12, 2009 Hi All, I have a upload script that reads a csv file then replaces the contents. Currently the script just grabs a csv file, but id like to be able to grab csv feeds that are compressed . I have a script for this but it doesnt seem to work.. Any help would be appreciated. This is my old code $to_rep = array_keys($arr); $file = 'affiliatefuture.csv'; //file name here $lines = file($file); foreach($lines as $k=>$line) { This is the new code $url = 'http://datafeed.api.productserve.com/compression/gzip/'; //grabbing whole file at once foreach (file("compress.zlib://$url") as $line) { $data = explode(',', $line); var_dump($data); } //one line at a time to conserve memory (better for very large files) $file = fopen("compress.zlib://$url", 'r'); while ($data = fgetcsv($file)) { var_dump($data); } fclose($file); $lines = file($file); foreach($lines as $k=>$line) { Link to comment https://forums.phpfreaks.com/topic/149138-solved-get-csvgzip-file/ Share on other sites More sharing options...
iceblox Posted March 12, 2009 Author Share Posted March 12, 2009 Any suggestions guys? Cheers, Phil Link to comment https://forums.phpfreaks.com/topic/149138-solved-get-csvgzip-file/#findComment-783247 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.