0

i'm developing my own plugin. in that i used a simple php file to generate contact vcards in the plugin folder. for this i used fopen & fwrite. but the file is not creating in the plugin folder. this is my code:

function Vcard(){
$path =EMAIL_PLUGIN_URL.'/MyFile.txt';
$Handle = (file_exists($path))? fopen($path, "a+") : fopen($path, "w+");
$sql="select the rows from my db";
$rs =/* db array result*/
 while(until the last result) {
 $Data="BEGIN:VCARD"."\n"."VERSION:2.1"."\n";  $Data.="N:".$row['eemail_name_sub'].';'."\n"."FN:".$row['eemail_name_sub']."\n";
$Data.="TEL;CELL:".'+91'.$row['eemail_mobile_sub']."\n"."END:VCARD"."\n";
 fwrite($Handle, $Data);
 }
fclose($Handle); 
$p="data written";
 return $p;
}

What may be the reason for this? also how can i download this vcard at the same moment after it is created and written?

  • Does fopen() call work at all (not return false)? Why do you need to save these files? From personal experience vcards are easier to just generate and serve on the fly. – Rarst Jun 5 '14 at 15:15
  • there is a list of patient numbers and names and i need to integrate those numbers to phone contacts. for that one method i thought is to generate .vcf files so that it would be easier for syncing with phone contacts. the php file works in separately run but when i paste the file in plugin folder fopen is not creating file – Zammuuz Jun 6 '14 at 3:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.