Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
    
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 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 –  Ammu Jun 6 at 3:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.