Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5987955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:53:23+00:00 2026-05-22T22:53:23+00:00

Ok like a plonker I thought it would be easy as. We have a

  • 0

Ok like a plonker I thought it would be easy as.

We have a popup with clients details in, to look like a vCard ( but heavily styled ) all propagated via our db on the fly.

So I just thought yeah no worries, we can use php within the vcard, and parse the relevant info .. so that wneh user clicks d/l link they get the correct vCard details..

Hmmm nope, and finding info about vCards etc is hard.

So here is a snippet of the vcard.vcf

BEGIN:VCARD
VERSION:2.1
N;LANGUAGE=en-in:Name;Type;Your
FN:Type Your Name
TEL;WORK;VOICE:+1 (800) 123 4567

Example TEL is rendered in our php like: <?=$r['tel'];?>

So how do we get php within the vcard to make it useable.. any hints appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:53:23+00:00Added an answer on May 22, 2026 at 10:53 pm

    The following is an example of a VCard file containing information for one person:

    vCard 2.1:

    BEGIN:VCARD
    VERSION:2.1
    N:Gump;Forrest
    FN:Forrest Gump
    ORG:Bubba Gump Shrimp Co.
    TITLE:Shrimp Man
    TEL;WORK;VOICE:(111) 555-1212
    TEL;HOME;VOICE:            (404) 555-1212      
    ADR;WORK:;;100 Waters Edge;Baytown;LA;30314;United States of America
    LABEL;WORK;ENCODING=QUOTED-PRINTABLE:100 Waters Edge=0D=0ABaytown, LA 30314=0D=0AUnited States of   America
    ADR;HOME:;;42 Plantation St.;Baytown;LA;30314;United States of America
    LABEL;HOME;ENCODING=QUOTED-PRINTABLE:42 Plantation St.=0D=0ABaytown, LA 30314=0D=0AUnited States of America
    EMAIL;PREF;INTERNET:forrestgump@example.com
    REV:20080424T195243Z
    END:VCARD
    

    vCard 3.0:

    BEGIN:VCARD
    VERSION:3.0
    N:Gump;Forrest
    FN:Forrest Gump
    ORG:Bubba Gump Shrimp Co.
    TITLE:Shrimp Man
    PHOTO;VALUE=URL;TYPE=GIF:http://www.example.com/dir_photos/my_photo.gif
    TEL;TYPE=WORK,VOICE:(111) 555-1212
    TEL;TYPE=HOME,VOICE:            (404) 555-1212      
    ADR;TYPE=WORK:;;100 Waters Edge;Baytown;LA;30314;United States of America
    LABEL;TYPE=WORK:100 Waters Edge\nBaytown, LA 30314\nUnited States of America
    ADR;TYPE=HOME:;;42 Plantation St.;Baytown;LA;30314;United States of America
    LABEL;TYPE=HOME:42 Plantation St.\nBaytown, LA 30314\nUnited States of America
    EMAIL;TYPE=PREF,INTERNET:forrestgump@example.com
    REV:20080424T195243Z
    END:VCARD
    

    Once you have all your data in a formant you can use say a string variable :

    <?php
        header("Content-type: application/octet-stream");
        header("Content-Disposition: attachment; filename=\"vCard.vcf\"");
        echo $data;
    ?>
    

    You can also if you wish create the file and off a link to that:

    $ourFileName = "vCard.vcf";
    $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
    fclose($ourFileHandle);
    

    I hope this puts you on track and that I have understood your question correctly.

    ANSWER:

    <?php
        $vCard = "BEGIN:VCARD
        VERSION:3.0
        N:Gump;Forrest
        FN:Forrest Gump
        ORG:Bubba Gump Shrimp Co.
        TITLE:Shrimp Man
        PHOTO;VALUE=URL;TYPE=GIF:http://www.example.com/dir_photos/my_photo.gif
        TEL;TYPE=WORK,VOICE:(111) 555-1212
        TEL;TYPE=HOME,VOICE:(404) 555-1212
        ADR;TYPE=WORK:;;100 Waters Edge;Baytown;LA;30314;United States of America
        LABEL;TYPE=WORK:100 Waters Edge\nBaytown, LA 30314\nUnited States of America
        ADR;TYPE=HOME:;;42 Plantation St.;Baytown;LA;30314;United States of America
        LABEL;TYPE=HOME:42 Plantation St.\nBaytown, LA 30314\nUnited States of America
        EMAIL;TYPE=PREF,INTERNET:forrestgump@example.com
        REV:20080424T195243Z
        END:VCARD";
    
        header("Content-type: application/octet-stream");
        header("Content-Disposition: attachment; filename=\"vCard.vcf\"");
        echo $vCard;
    ?>
    

    The above code will allow the user to to download the vCard held in $vCard. In your case you would need to add your own data an example of how this would go is shown below:

        $vCard = "BEGIN:VCARD
        VERSION:3.0
        N:Gump;Forrest
        FN:Forrest Gump
        ORG:Bubba Gump Shrimp Co.
        TITLE:".$array['title']."
        PHOTO;VALUE=URL;TYPE=GIF:".$array['weblink']."
        TEL;TYPE=WORK,VOICE:".$array['WORKNUM']."
        TEL;TYPE=HOME,VOICE:".$array['HOMENUM']."
        ADR;TYPE=WORK:;;100 Waters Edge;Baytown;LA;30314;".$array['Country']."
        LABEL;TYPE=WORK:100 Waters Edge\nBaytown, LA 30314\n".$array['Country']."
        ADR;TYPE=HOME:;;42 Plantation St.;Baytown;LA;30314;".$array['Country']."
        LABEL;TYPE=HOME:42 Plantation St.\nBaytown, LA 30314\nUnited States of America
        EMAIL;TYPE=PREF,INTERNET:forrestgump@example.com
        REV:20080424T195243Z
        END:VCARD";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Like HTTP Headers in firefox, I would like to save all the HTTP requests
Like the title. I have a small drawable file, but the ImageView is much
Like there are many Applications which are just basic but you can have install
Like the Delicious submission bookmark-let, I'd like to have some standard JavaScript I can
Like many companies that require all access be through stored procedures, we seem to
Like the title says, I want to parse XML in my iPhone application, but
Like window.open(); window.close(); Do we have any facility to hide a window. I have
Like String r = SomeThing.toExecString(new Object().toString()); And when executed the value of r would
Like Select[Tuples[Range[0, n], d], Total[#] == n &] , but faster? Update Here are
Like https://stackoverflow.com/questions/1521646/best-profanity-filter , but for Python — and I’m looking for libraries I can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.