How to export data in QIF format using codeigniter?

129 Views Asked by At

How I export my data in qif format. I didn't get any idea, how I Can? Please help me to find out the way.

1

There are 1 best solutions below

0
On BEST ANSWER

try this //i don't know what is the qif text format, but with this you can write a file

write_file.php

public function write_qif( $info ){
    $this->load->helper(array('file','download'));
    $_info    = $this->some_model->get_info($info);//return object
    $qif_text = '
                 !Type:'.$_info->type.'//BANK
                 D'.$_info->date1.'//03/03/10
                 T-379.00
                 P'.$_info->city.'//CITY OF
                 ^
                 D'.$_info->date2.'//03/04/10
                 T-20.28
                 P'.$_info->maket_place.'//YOUR LOCAL SUPERMARKET
                 ^
                 D'.$_info->date3.'//03/03/10
                 T-421.35
                 P'.$_info->product.'//...WATER UTILITY
                 ';

    if ( ! write_file('./path/to/file.qif', $_info)){
        echo 'Unable to write the file';
    }
    else{
        $data = file_get_contents(.'/path/to/file.qif');
        $name = 'myqiffile.qif';

        force_download($name, $data); 
        echo 'File written!';
    }
}