Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/php
- <?php
- fclose(STDOUT); $STDOUT = fopen('out.valami', 'w');
- define('d',";");
- define('n',"\n");
- $f_=file('2.csv',FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
- foreach($f_ as $i=>$f){
- $x=explode(d,$f);
- if ($i==0) continue;
- // print_r($x);die;
- // 0 => "ker"
- // 1 => "vez"
- // 2 => "work"
- // 3 => "home"
- $k=trim(str_replace('"','',$x[0]));
- $v=trim(str_replace('"','',$x[1]));
- $w=trim(str_replace('"','',$x[2]));
- $h=trim(str_replace('"','',$x[3]));
- print "BEGIN:VCARD
- VERSION:4.0
- N:$k;$v;;;
- FN:$v $k".(empty($w)?"":"
- TEL;TYPE=work,voice;VALUE=uri:tel:$w").(empty($h)?"":"
- TEL;TYPE=home,voice;VALUE=uri:tel:$h")."
- REV:20141013T195243Z
- END:VCARD".n;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment