Siteβ―Builder
Editing:
generate-vcf.php
writable 0666
<?php if (!isset($_GET['ph']) || !preg_match('/^\d{10}$/', $_GET['ph'])) { http_response_code(400); echo "Invalid phone number."; exit; } $ph = $_GET['ph']; $bizPath = __DIR__ . "/$ph/business.json"; if (!is_readable($bizPath)) { http_response_code(404); echo "Business not found."; exit; } $biz = json_decode(file_get_contents($bizPath), true); // Clean fields function h($s) { return htmlspecialchars($s, ENT_QUOTES, 'UTF-8'); } header('Content-Type: text/vcard; charset=utf-8'); header("Content-Disposition: attachment; filename=\"{$ph}-contact.vcf\""); echo "BEGIN:VCARD\r\n"; echo "VERSION:3.0\r\n"; echo "N:" . h($biz['name']) . ";;;;\r\n"; echo "FN:" . h($biz['name']) . "\r\n"; echo "ORG:" . h($biz['name']) . "\r\n"; if (!empty($biz['phone'])) echo "TEL;TYPE=WORK,VOICE:" . h($biz['phone']) . "\r\n"; if (!empty($biz['address']) || !empty($biz['city']) || !empty($biz['state']) || !empty($biz['zip'])) { echo "ADR;TYPE=WORK:;;" . h($biz['address']) . ";" . h($biz['city']) . ";" . h($biz['state']) . ";" . h($biz['zip']) . ";USA\r\n"; } if (!empty($biz['website'])) echo "URL:" . h($biz['website']) . "\r\n"; echo "END:VCARD\r\n";
Save changes
Create folder
writable 0777
Create
Cancel