Files
mantelzorgwoning.info/static/prefill.php

28 lines
723 B
PHP

<?php
// prefill.php
$apiKey = '31b69c04fc1944c905bcf895789c1c98';
$crmBaseUrl = 'https://crm.start-it.nl/api/v1/Account/';
$id = $_GET['id'] ?? '';
if (!$id || !preg_match('/^[a-z0-9]+$/', $id)) {
http_response_code(400);
die(json_encode(['error' => 'Invalid ID']));
}
$opts = [
"http" => [
"method" => "GET",
"header" => "X-Api-Key: $apiKey\r\nContent-Type: application/json\r\n"
]
];
$context = stream_context_create($opts);
$response = @file_get_contents($crmBaseUrl . $id, false, $context);
if ($response === false) {
http_response_code(404);
echo json_encode(['error' => 'CRM record not found']);
} else {
header('Content-Type: application/json');
echo $response;
}