php - Download vcf from iPhone Safari
Get the solution ↓↓↓Doing a php project that need to generate a .vcf file and allow mobile user to save into phone Contacts. The issue I am facing is that I cannot download the generated vcf using iPhone safari. On Android with Chrome, it work fine. I did some googling and searching and got very confused.
I read that in older ios ( < ios 6.0 ) version, this is an known issue for iPhone safari. But I also read in some that said newer version of ios, this is now possible. . I test using ios 14 and is facing this issue.
So it is really that iPhone safari does not support downloading of vcf even with the newer ios version ( ios > 6.0 )
My test php script to generate vcf is basic and as follow:
<?php
// define here all the variable like $name,$image,$company_name & all other
header('Content-Type: text/x-vcard');
header('Content-Disposition: inline; filename= "'.$_GET['EMAIL'].'.vcf"');
$vCard = "BEGIN:VCARD\r\n";
$vCard .= "VERSION:3.0\r\n";
$vCard .= "FN:" . $_GET['NAME'] . "\r\n";
$vCard .= "TITLE:" . $_GET['COMPANY'] . "\r\n";
if($_GET['EMAIL']){
$vCard .= "EMAIL;TYPE=Email,pref:" . $_GET['EMAIL'] . "\r\n";
}
if($_GET['PHONE']){
$vCard .= "TEL;TYPE=work,voice:" . $_GET['PHONE'] . "\r\n";
}
$vCard .= "END:VCARD\r\n";
echo $vCard;
?>
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: a non well formed numeric value encountered
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.